Class: Stupidedi::Reader::SegmentTok
- Includes:
- Inspect
- Defined in:
- lib/stupidedi/reader/tokens/segment_tok.rb
Instance Attribute Summary collapse
- #element_toks ⇒ Array<CompositeElementTok, SimpleElementTok> readonly
- #id ⇒ Symbol readonly
- #position ⇒ Position readonly
- #remainder ⇒ Position readonly
Constructors collapse
Instance Method Summary collapse
- #blank? ⇒ Boolean
-
#initialize(id, element_toks, position, remainder) ⇒ SegmentTok
constructor
A new instance of SegmentTok.
- #present? ⇒ Boolean
- #pretty_print(q) ⇒ Object
Methods included from Inspect
Constructor Details
#initialize(id, element_toks, position, remainder) ⇒ SegmentTok
Returns a new instance of SegmentTok.
19 20 21 22 |
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 19 def initialize(id, element_toks, position, remainder) @id, @element_toks, @position, @remainder = id, element_toks, position, remainder end |
Instance Attribute Details
#element_toks ⇒ Array<CompositeElementTok, SimpleElementTok> (readonly)
11 12 13 |
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 11 def element_toks @element_toks end |
#id ⇒ Symbol (readonly)
8 9 10 |
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 8 def id @id end |
#position ⇒ Position (readonly)
14 15 16 |
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 14 def position @position end |
#remainder ⇒ Position (readonly)
17 18 19 |
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 17 def remainder @remainder end |
Class Method Details
.build(id, element_toks, position, remainder) ⇒ SegmentTok
42 43 44 |
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 42 def build(id, element_toks, position, remainder) new(id, element_toks, position, remainder) end |
Instance Method Details
#blank? ⇒ Boolean
28 29 30 |
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 28 def blank? @element_toks.all(&:blank?) end |
#present? ⇒ Boolean
32 33 34 |
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 32 def present? not blank? end |
#pretty_print(q) ⇒ Object
24 25 26 |
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 24 def pretty_print(q) q.pp(:segment.cons(@id.cons(@element_toks))) end |