Class: Stupidedi::Reader::ComponentElementTok
- Inherits:
-
Object
- Object
- Stupidedi::Reader::ComponentElementTok
- Includes:
- Inspect
- Defined in:
- lib/stupidedi/reader/tokens/component_element_tok.rb
Instance Attribute Summary collapse
- #position ⇒ Position readonly
- #remainder ⇒ Position readonly
- #value ⇒ String readonly
Constructors collapse
Instance Method Summary collapse
-
#blank? ⇒ Boolean
:nocov:.
- #composite? ⇒ Boolean
- #copy(changes = {}) ⇒ CompositeElementTok
-
#initialize(value, position, remainder) ⇒ ComponentElementTok
constructor
A new instance of ComponentElementTok.
- #present? ⇒ Boolean
-
#pretty_print(q)
:nocov:.
- #simple? ⇒ Boolean
- #to_x12(separators)
Methods included from Inspect
Constructor Details
#initialize(value, position, remainder) ⇒ ComponentElementTok
Returns a new instance of ComponentElementTok.
18 19 20 21 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 18 def initialize(value, position, remainder) @value, @position, @remainder = value, position, remainder end |
Instance Attribute Details
#position ⇒ Position (readonly)
13 14 15 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 13 def position @position end |
#remainder ⇒ Position (readonly)
16 17 18 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 16 def remainder @remainder end |
#value ⇒ String (readonly)
10 11 12 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 10 def value @value end |
Class Method Details
.build(value, position, remainder) ⇒ ComponentElementTok
63 64 65 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 63 def build(value, position, remainder) new(value, position, remainder) end |
Instance Method Details
#blank? ⇒ Boolean
:nocov:
37 38 39 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 37 def blank? @value.blank? end |
#composite? ⇒ Boolean
49 50 51 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 49 def composite? false end |
#copy(changes = {}) ⇒ CompositeElementTok
24 25 26 27 28 29 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 24 def copy(changes = {}) ComponentElementTok.new \ changes.fetch(:value, @value), changes.fetch(:position, @position), changes.fetch(:remainder, @remainder) end |
#present? ⇒ Boolean
41 42 43 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 41 def present? not blank? end |
#pretty_print(q)
:nocov:
32 33 34 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 32 def pretty_print(q) q.pp(:component.cons(@value.cons)) end |
#simple? ⇒ Boolean
45 46 47 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 45 def simple? true end |
#to_x12(separators)
53 54 55 |
# File 'lib/stupidedi/reader/tokens/component_element_tok.rb', line 53 def to_x12(separators) @value.to_s end |