Class: Moblues::DataModel::Attribute
- Inherits:
-
Struct
- Object
- Struct
- Moblues::DataModel::Attribute
- Defined in:
- lib/moblues/data_model/attribute.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#optional ⇒ Object
Returns the value of attribute optional.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(params) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(params) ⇒ Attribute
Returns a new instance of Attribute.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/moblues/data_model/attribute.rb', line 6 def initialize(params) p = params.compact optional = false optional = p.fetch(:optional) if p.key?(:optional) super( p.fetch(:name), p.fetch(:type), optional ) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
5 6 7 |
# File 'lib/moblues/data_model/attribute.rb', line 5 def name @name end |
#optional ⇒ Object
Returns the value of attribute optional
5 6 7 |
# File 'lib/moblues/data_model/attribute.rb', line 5 def optional @optional end |
#type ⇒ Object
Returns the value of attribute type
5 6 7 |
# File 'lib/moblues/data_model/attribute.rb', line 5 def type @type end |