Class: AttributeList

Inherits:
Array
  • Object
show all
Defined in:
lib/json_mapper/attribute_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})

  self.name = name
  self.source_attributes = source_attributes.is_a?(Array) ? source_attributes : [ source_attributes ]
  self.type = type
  self.options = options

end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/json_mapper/attribute_list.rb', line 3

def name
  @name
end

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/json_mapper/attribute_list.rb', line 3

def options
  @options
end

#source_attributesObject

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

#typeObject

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_nameObject



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

Returns:



21
22
23
# File 'lib/json_mapper/attribute_list.rb', line 21

def self_referential?
  false # Attribute lists can't be self referential
end

#typecastObject



18
19
# File 'lib/json_mapper/attribute_list.rb', line 18

def typecast
end