Class: AttributeList
- Inherits:
-
Array
- Object
- Array
- AttributeList
- Defined in:
- lib/json_mapper/attribute_list.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#source_attributes ⇒ Object
Returns the value of attribute source_attributes.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, source_attributes, type, options = {}) ⇒ AttributeList
constructor
A new instance of AttributeList.
- #method_name ⇒ Object
- #self_referential? ⇒ Boolean
- #typecast ⇒ Object
Constructor Details
#initialize(name, source_attributes, type, options = {}) ⇒ AttributeList
Returns a new instance of AttributeList.
5 6 7 8 9 10 11 12 |
# File 'lib/json_mapper/attribute_list.rb', line 5 def initialize(name, source_attributes, type, = {}) self.name = name self.source_attributes = source_attributes.is_a?(Array) ? source_attributes : [ source_attributes ] self.type = type self. = end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/json_mapper/attribute_list.rb', line 3 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/json_mapper/attribute_list.rb', line 3 def @options end |
#source_attributes ⇒ Object
Returns the value of attribute source_attributes.
3 4 5 |
# File 'lib/json_mapper/attribute_list.rb', line 3 def source_attributes @source_attributes end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/json_mapper/attribute_list.rb', line 3 def type @type end |
Instance Method Details
#method_name ⇒ Object
14 15 16 |
# File 'lib/json_mapper/attribute_list.rb', line 14 def method_name @method_name ||= self.name.to_s.tr("-", "_") end |
#self_referential? ⇒ Boolean
21 22 23 |
# File 'lib/json_mapper/attribute_list.rb', line 21 def self_referential? false # Attribute lists can't be self referential end |
#typecast ⇒ Object
18 19 |
# File 'lib/json_mapper/attribute_list.rb', line 18 def typecast end |