Module: SecurityGuard::Concerns::AcceptsFromFile::ClassMethods

Defined in:
lib/security_guard/concerns/accepts_from_file.rb

Instance Method Summary collapse

Instance Method Details

#accepts_from_file(*attributes) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/security_guard/concerns/accepts_from_file.rb', line 9

def accepts_from_file(*attributes)
  attributes.each do |attribute|
    self.send :attr_accessor, attribute
    self.send :define_method, "#{attribute}_from_file=", lambda { |file|
      self.send "#{attribute}=", SecurityGuard::Utils::Files.to_array(file)
    }
  end
end