class Netfira::WebConnect::Model::Record::FileRecord::Validator

Public Class Methods

remote_file_sources_filter() click to toggle source
# File lib/netfira/web_connect/model/record/file_record.rb, line 29
def self.remote_file_sources_filter
  @remote_file_sources_filter ||= Regexp.new(ENV['REMOTE_FILE_SOURCES_FILTER'] || '^https?://', Regexp::IGNORECASE)
end

Public Instance Methods

validate(record) click to toggle source
# File lib/netfira/web_connect/model/record/file_record.rb, line 32
def validate(record)
  if record.remote_location && !(record.remote_location =~ self.class.remote_file_sources_filter)
    record.errors[:remote_location] << 'Unacceptable format'
  end
end