Class: Stupidedi::Reader::CompositeElementTok

Inherits:
Object
  • Object
show all
Includes:
Inspect
Defined in:
lib/stupidedi/reader/tokens/composite_element_tok.rb

Instance Attribute Summary collapse

Constructors collapse

Instance Method Summary collapse

Methods included from Inspect

#inspect

Constructor Details

#initialize(component_toks, position, remainder) ⇒ CompositeElementTok

Returns a new instance of CompositeElementTok


19
20
21
22
# File 'lib/stupidedi/reader/tokens/composite_element_tok.rb', line 19

def initialize(component_toks, position, remainder)
  @component_toks, @position, @remainder =
    component_toks, position, remainder
end

Instance Attribute Details

#component_toksArray<ComponentElementTok> (readonly)

Returns:


11
12
13
# File 'lib/stupidedi/reader/tokens/composite_element_tok.rb', line 11

def component_toks
  @component_toks
end

#positionPosition (readonly)

Returns:


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

def position
  @position
end

#remainderPosition (readonly)

Returns:


17
18
19
# File 'lib/stupidedi/reader/tokens/composite_element_tok.rb', line 17

def remainder
  @remainder
end

Class Method Details

.build(component_toks, position, remainder) ⇒ CompositeElementTok

Returns:


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

def build(component_toks, position, remainder)
  new(component_toks, position, remainder)
end

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)

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

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

#composite?Boolean

Returns:

  • (Boolean)

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

def composite?
  true
end

#present?Boolean

Returns:

  • (Boolean)

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

def present?
  not blank?
end

#pretty_print(q)


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

def pretty_print(q)
  q.pp(:composite.cons(@component_toks))
end

#repeated


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

def repeated
  RepeatedElementTok.new(self.cons, @position)
end

#repeated?Boolean

Returns:

  • (Boolean)

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

def repeated?
  false
end

#simple?Boolean

Returns:

  • (Boolean)

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

def simple?
  false
end