Class: Stupidedi::Reader::RepeatedElementTok
- Extended by:
- Forwardable
- Includes:
- Inspect
- Defined in:
- lib/stupidedi/reader/tokens/repeated_element_tok.rb
Instance Attribute Summary collapse
- #element_toks ⇒ Array<CompositeElementTok>, Array<SimpleElementTok> readonly
-
#position ⇒ Object
readonly
Returns the value of attribute position.
Constructors collapse
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #composite? ⇒ Boolean
-
#initialize(element_toks, position) ⇒ RepeatedElementTok
constructor
A new instance of RepeatedElementTok.
- #present? ⇒ Boolean
- #pretty_print(q) ⇒ Object
- #repeated(element_tok) ⇒ Object
- #repeated? ⇒ Boolean
- #simple? ⇒ Boolean
Methods included from Inspect
Constructor Details
#initialize(element_toks, position) ⇒ RepeatedElementTok
Returns a new instance of RepeatedElementTok.
16 17 18 19 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 16 def initialize(element_toks, position) @element_toks, @position = element_toks, position end |
Instance Attribute Details
#element_toks ⇒ Array<CompositeElementTok>, Array<SimpleElementTok> (readonly)
9 10 11 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 9 def element_toks @element_toks end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
11 12 13 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 11 def position @position end |
Class Method Details
.build(element_toks, position) ⇒ RepeatedElementTok
56 57 58 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 56 def build(element_toks, position) new(element_toks, position) end |
Instance Method Details
#blank? ⇒ Boolean
38 39 40 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 38 def blank? @element_toks.all?(&:blank?) end |
#composite? ⇒ Boolean
46 47 48 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 46 def composite? false end |
#present? ⇒ Boolean
42 43 44 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 42 def present? not blank? end |
#pretty_print(q) ⇒ Object
26 27 28 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 26 def pretty_print(q) q.pp(:repeated.cons(@element_toks)) end |
#repeated(element_tok) ⇒ Object
21 22 23 24 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 21 def repeated(element_tok) @element_toks.unshift(element_tok) self end |
#repeated? ⇒ Boolean
34 35 36 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 34 def repeated? true end |
#simple? ⇒ Boolean
30 31 32 |
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 30 def simple? false end |