Class: Carpenter::Model::Field
- Inherits:
-
Object
- Object
- Carpenter::Model::Field
- Defined in:
- lib/struct_declaration.rb,
lib/carpenter/model/field.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(field_definition, key) ⇒ Field
constructor
A new instance of Field.
Constructor Details
#initialize(field_definition, key) ⇒ Field
Returns a new instance of Field.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/carpenter/model/field.rb', line 7 def initialize(field_definition, key) @name = field_definition.name @type = field_definition.type @type_caster = Carpenter::Model::TypeCaster[@type] @key = [key, @name].join(':') @definition = field_definition = field_definition. @force = [:force].nil? ? false : [:force] @store = [:store].nil? ? false : [:store] @default = [:default] @options = extend Carpenter::Model::Strategy[@type] end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/carpenter/model/field.rb', line 5 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/carpenter/model/field.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/carpenter/model/field.rb', line 5 def @options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/carpenter/model/field.rb', line 5 def type @type end |