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



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

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)



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

def element_toks
  @element_toks
end

#idSymbol (readonly)

Returns:

  • (Symbol)


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

def id
  @id
end

#positionPosition (readonly)

Returns:



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

def position
  @position
end

#remainderPosition (readonly)

Returns:



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

def remainder
  @remainder
end

Class Method Details

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

Returns:



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

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

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


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

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

#present?Boolean

Returns:

  • (Boolean)


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

def present?
  not blank?
end

#pretty_print(q)



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

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