Class: Stupidedi::Reader::SegmentTok

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

Instance Attribute Summary collapse

Constructors collapse

Instance Method Summary collapse

Methods included from Inspect

#inspect

Constructor Details

#initialize(id, element_toks, position, remainder) ⇒ SegmentTok

Returns a new instance of SegmentTok



22
23
24
25
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 22

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

Instance Attribute Details

#element_toksArray<CompositeElementTok, SimpleElementTok> (readonly)



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

def element_toks
  @element_toks
end

#idSymbol (readonly)

Returns:

  • (Symbol)


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

def id
  @id
end

#positionPosition (readonly)

Returns:



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

def position
  @position
end

#remainderPosition (readonly)

Returns:



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

def remainder
  @remainder
end

Class Method Details

.build(id, element_toks, position, remainder) ⇒ SegmentTok

Returns:



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

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

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 31

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

#present?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 35

def present?
  not blank?
end

#pretty_print(q)



27
28
29
# File 'lib/stupidedi/reader/tokens/segment_tok.rb', line 27

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