Class: ActiveRecord::Bixformer::Attribute::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Bixformer::Attribute::Base
- Defined in:
- lib/activerecord-bixformer/attribute/base.rb
Direct Known Subclasses
Boolean, Booletania, Date, Enumerize, FormattedForeignKey, Integer, Override, String, Time
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #export(record) ⇒ Object
- #import(value) ⇒ Object
-
#initialize(model, attribute_name, options) ⇒ Base
constructor
A new instance of Base.
- #should_be_included ⇒ Object
Constructor Details
#initialize(model, attribute_name, options) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 |
# File 'lib/activerecord-bixformer/attribute/base.rb', line 7 def initialize(model, attribute_name, ) @model = model @name = attribute_name.to_s @options = (.is_a?(::Hash) ? : {}).with_indifferent_access @options[:raise] = true unless @options.key?(:raise) end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
5 6 7 |
# File 'lib/activerecord-bixformer/attribute/base.rb', line 5 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/activerecord-bixformer/attribute/base.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/activerecord-bixformer/attribute/base.rb', line 5 def @options end |
Instance Method Details
#export(record) ⇒ Object
15 16 17 |
# File 'lib/activerecord-bixformer/attribute/base.rb', line 15 def export(record) record_attribute_value(record) end |
#import(value) ⇒ Object
19 20 21 |
# File 'lib/activerecord-bixformer/attribute/base.rb', line 19 def import(value) value end |
#should_be_included ⇒ Object
23 24 25 |
# File 'lib/activerecord-bixformer/attribute/base.rb', line 23 def should_be_included nil end |