Class: Uorm::Attributes::Field
- Inherits:
-
Object
- Object
- Uorm::Attributes::Field
- Defined in:
- lib/uorm/attributes/field.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #as_json(value) ⇒ Object
- #convert(value) ⇒ Object
-
#initialize(name, type) ⇒ Field
constructor
A new instance of Field.
Constructor Details
#initialize(name, type) ⇒ Field
Returns a new instance of Field.
6 7 8 9 |
# File 'lib/uorm/attributes/field.rb', line 6 def initialize name, type @name = name.to_sym @type = parse_type type end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/uorm/attributes/field.rb', line 4 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/uorm/attributes/field.rb', line 4 def type @type end |
Instance Method Details
#as_json(value) ⇒ Object
15 16 17 |
# File 'lib/uorm/attributes/field.rb', line 15 def as_json value type.as_json value if value end |
#convert(value) ⇒ Object
11 12 13 |
# File 'lib/uorm/attributes/field.rb', line 11 def convert value type.convert value if value end |