Class: Code42::Attribute
- Inherits:
-
Object
- Object
- Code42::Attribute
- Defined in:
- lib/code42/attribute.rb
Instance Attribute Summary collapse
-
#as ⇒ Object
readonly
Returns the value of attribute as.
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#name ⇒ Object
(also: #to)
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(name, options = {}) ⇒ Attribute
Returns a new instance of Attribute.
6 7 8 9 10 11 |
# File 'lib/code42/attribute.rb', line 6 def initialize(name, = {}) @name = name.to_sym @from = ([:from] || name.to_s.camelize(:lower)).to_s @as = [:as] @collection = [:collection] end |
Instance Attribute Details
#as ⇒ Object (readonly)
Returns the value of attribute as.
3 4 5 |
# File 'lib/code42/attribute.rb', line 3 def as @as end |
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
3 4 5 |
# File 'lib/code42/attribute.rb', line 3 def collection @collection end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
3 4 5 |
# File 'lib/code42/attribute.rb', line 3 def from @from end |
#name ⇒ Object (readonly) Also known as: to
Returns the value of attribute name.
3 4 5 |
# File 'lib/code42/attribute.rb', line 3 def name @name end |