Class: Stupidedi::Reader::RepeatedElementTok

Inherits:
Object
  • Object
show all
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


18
19
20
21
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 18

def initialize(element_toks, position)
  @element_toks, @position =
    element_toks, position
end

Instance Attribute Details

#element_toksArray<CompositeElementTok>, Array<SimpleElementTok> (readonly)

Returns:


12
13
14
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 12

def element_toks
  @element_toks
end

#position (readonly)

Returns the value of attribute position


14
15
16
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 14

def position
  @position
end

Class Method Details

.build(element_toks, position) ⇒ RepeatedElementTok

Returns:


58
59
60
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 58

def build(element_toks, position)
  new(element_toks, position)
end

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)

40
41
42
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 40

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

#composite?Boolean

Returns:

  • (Boolean)

48
49
50
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 48

def composite?
  false
end

#present?Boolean

Returns:

  • (Boolean)

44
45
46
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 44

def present?
  not blank?
end

#pretty_print(q)


28
29
30
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 28

def pretty_print(q)
  q.pp(:repeated.cons(@element_toks))
end

#repeated(element_tok)


23
24
25
26
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 23

def repeated(element_tok)
  @element_toks.unshift(element_tok)
  self
end

#repeated?Boolean

Returns:

  • (Boolean)

36
37
38
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 36

def repeated?
  true
end

#simple?Boolean

Returns:

  • (Boolean)

32
33
34
# File 'lib/stupidedi/reader/tokens/repeated_element_tok.rb', line 32

def simple?
  false
end