Class: 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
-
#initialize(value, position, remainder) ⇒ SimpleElementTok
constructor
A new instance of SimpleElementTok.
- #present? ⇒ Boolean
- #pretty_print(q) ⇒ Object
- #repeated ⇒ Object
- #repeated? ⇒ Boolean
- #simple? ⇒ Boolean
Methods included from Inspect
Constructor Details
#initialize(value, position, remainder) ⇒ SimpleElementTok
Returns a new instance of SimpleElementTok.
16 17 18 19 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 16 def initialize(value, position, remainder) @value, @position, @remainder = value, position, remainder end |
Instance Attribute Details
#position ⇒ Position (readonly)
11 12 13 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 11 def position @position end |
#remainder ⇒ Position (readonly)
14 15 16 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 14 def remainder @remainder end |
Class Method Details
.build(value, position, remainder) ⇒ Object
54 55 56 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 54 def build(value, position, remainder) new(value, position, remainder) end |
Instance Method Details
#blank? ⇒ Boolean
33 34 35 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 33 def blank? @value.blank? end |
#composite? ⇒ Boolean
45 46 47 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 45 def composite? false end |
#present? ⇒ Boolean
37 38 39 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 37 def present? not blank? end |
#pretty_print(q) ⇒ Object
21 22 23 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 21 def pretty_print(q) q.pp(:simple.cons(@value.cons)) end |
#repeated ⇒ Object
25 26 27 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 25 def repeated RepeatedElementTok.new(self.cons, @position) end |
#repeated? ⇒ Boolean
29 30 31 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 29 def repeated? false end |
#simple? ⇒ Boolean
41 42 43 |
# File 'lib/stupidedi/reader/tokens/simple_element_tok.rb', line 41 def simple? true end |