Class: Stupidedi::Reader::SimpleElementTok
- Inherits:
-
Object
- Object
- Stupidedi::Reader::SimpleElementTok
- Includes:
- Inspect
- Defined in:
- lib/stupidedi/reader/tokens/simple_element_tok.rb
Instance Attribute Summary collapse
- #position ⇒ Position readonly
- #remainder ⇒ Position readonly
- #value ⇒ String, Object readonly
Constructors collapse
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #composite? ⇒ Boolean
- #copy(changes = {}) ⇒ SimpleElementTok
-
#initialize(value, position, remainder) ⇒ SimpleElementTok
constructor
A new instance of SimpleElementTok.
- #present? ⇒ Boolean
- #pretty_print(q)
- #repeated
- #repeated? ⇒ Boolean
- #simple? ⇒ Boolean
- #to_x12(separators)
Methods included from Inspect
Constructor Details
#initialize(value, position, remainder) ⇒ SimpleElementTok
Returns a new instance of SimpleElementTok.
18 19 20 21 |
# File 'lib/stupidedi/reader/tokens/simple_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/simple_element_tok.rb', line 13 def position @position end |
#remainder ⇒ Position (readonly)
16 17 18 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 16 def remainder @remainder end |
#value ⇒ String, Object (readonly)
10 11 12 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 10 def value @value end |
Class Method Details
.build(value, position, remainder)
68 69 70 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 68 def build(value, position, remainder) new(value, position, remainder) end |
Instance Method Details
#blank? ⇒ Boolean
43 44 45 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 43 def blank? @value.blank? end |
#composite? ⇒ Boolean
55 56 57 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 55 def composite? false end |
#copy(changes = {}) ⇒ SimpleElementTok
24 25 26 27 28 29 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 24 def copy(changes = {}) SimpleElementTok.new \ changes.fetch(:value, @value), changes.fetch(:position, @position), changes.fetch(:remainder, @remainder) end |
#present? ⇒ Boolean
47 48 49 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 47 def present? not blank? end |
#pretty_print(q)
31 32 33 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 31 def pretty_print(q) q.pp(:simple.cons(@value.cons)) end |
#repeated
35 36 37 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 35 def repeated RepeatedElementTok.new(self.cons, @position) end |
#repeated? ⇒ Boolean
39 40 41 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 39 def repeated? false end |
#simple? ⇒ Boolean
51 52 53 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 51 def simple? true end |
#to_x12(separators)
59 60 61 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 59 def to_x12(separators) @value.to_s end |