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.



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

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

Instance Attribute Details

#component_toksArray<ComponentElementTok> (readonly)



8
9
10
# File 'lib/stupidedi/reader/tokens/composite_element_tok.rb', line 8

def component_toks
  @component_toks
end

#positionPosition (readonly)

Returns:



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

def position
  @position
end

#remainderPosition (readonly)

Returns:



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

def remainder
  @remainder
end

Class Method Details

.build(component_toks, position, remainder) ⇒ CompositeElementTok

Returns:



55
56
57
# File 'lib/stupidedi/reader/tokens/composite_element_tok.rb', line 55

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

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


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

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

#composite?Boolean

Returns:

  • (Boolean)


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

def composite?
  true
end

#present?Boolean

Returns:

  • (Boolean)


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

def present?
  not blank?
end

#pretty_print(q) ⇒ Object



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

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

#repeatedObject



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

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

#repeated?Boolean

Returns:

  • (Boolean)


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

def repeated?
  false
end

#simple?Boolean

Returns:

  • (Boolean)


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

def simple?
  false
end