Class: Vessel::Cargo::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/vessel/cargo/field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#blockObject (readonly)

Returns the value of attribute block.



6
7
8
# File 'lib/vessel/cargo/field.rb', line 6

def block
  @block
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/vessel/cargo/field.rb', line 6

def name
  @name
end

#typingObject (readonly)

Returns the value of attribute typing.



6
7
8
# File 'lib/vessel/cargo/field.rb', line 6

def typing
  @typing
end

#valueObject (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

#applyObject



16
17
18
19
20
# File 'lib/vessel/cargo/field.rb', line 16

def apply
  apply_block
  apply_typing
  value
end