Class: Stupidedi::Reader::RepeatedElementTok

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Inspect
Defined in:
lib/stupidedi/reader/tokens/repeated_element_tok.rb

Instance Attribute Summary collapse

Constructors collapse

Instance Method Summary collapse

Methods included from Inspect

#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_toksArray<CompositeElementTok>, Array<SimpleElementTok> (readonly)



9
10
11
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 9

def element_toks
  @element_toks
end

#positionObject (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

Returns:



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

Returns:

  • (Boolean)


38
39
40
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 38

def blank?
  @element_toks.all?(&:blank?)
end

#composite?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 46

def composite?
  false
end

#present?Boolean

Returns:

  • (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

Returns:

  • (Boolean)


34
35
36
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 34

def repeated?
  true
end

#simple?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 30

def simple?
  false
end