Class: ActiveAdminImport::Model
- Inherits:
-
Object
- Object
- ActiveAdminImport::Model
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion
- Defined in:
- lib/active_admin_import/model.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#file ⇒ Object
Returns the value of attribute file.
-
#hint ⇒ Object
Returns the value of attribute hint.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Model
constructor
A new instance of Model.
- #persisted? ⇒ Boolean
Constructor Details
#initialize(attributes = {}) ⇒ Model
Returns a new instance of Model.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/active_admin_import/model.rb', line 10 def initialize(attributes={}) self.hint= attributes.delete(:hint) @attributes = attributes @attributes.each do |key,value| #generate methods for instance object by attributes singleton_class.class_eval do define_method(key) { self.attributes[key] } unless method_defined? key define_method("#{key}=") { |new_value| @attributes[key] = new_value } unless method_defined? "#{key}=" end end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
8 9 10 |
# File 'lib/active_admin_import/model.rb', line 8 def attributes @attributes end |
#file ⇒ Object
Returns the value of attribute file.
6 7 8 |
# File 'lib/active_admin_import/model.rb', line 6 def file @file end |
#hint ⇒ Object
Returns the value of attribute hint.
7 8 9 |
# File 'lib/active_admin_import/model.rb', line 7 def hint @hint end |
Instance Method Details
#persisted? ⇒ Boolean
22 23 24 |
# File 'lib/active_admin_import/model.rb', line 22 def persisted? false end |