Class: Vessel::Cargo::Field
- Inherits:
-
Object
- Object
- Vessel::Cargo::Field
- Defined in:
- lib/vessel/cargo/field.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#typing ⇒ Object
readonly
Returns the value of attribute typing.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(name:, value:, context:, rename: nil, typing: true, &block) ⇒ Field
constructor
A new instance of Field.
Constructor Details
#initialize(name:, value:, context:, rename: nil, typing: true, &block) ⇒ Field
Returns a new instance of Field.
8 9 10 11 12 13 14 |
# File 'lib/vessel/cargo/field.rb', line 8 def initialize(name:, value:, context:, rename: nil, typing: true, &block) @name = rename(name, rename) @value = value @block = block @context = context @typing = FieldType.types[@name] if typing end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'lib/vessel/cargo/field.rb', line 6 def block @block end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/vessel/cargo/field.rb', line 6 def name @name end |
#typing ⇒ Object (readonly)
Returns the value of attribute typing.
6 7 8 |
# File 'lib/vessel/cargo/field.rb', line 6 def typing @typing end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/vessel/cargo/field.rb', line 6 def value @value end |
Instance Method Details
#apply ⇒ Object
16 17 18 19 20 |
# File 'lib/vessel/cargo/field.rb', line 16 def apply apply_block apply_typing value end |