Class: Stupidedi::Parser::IdentifierStack

Inherits:
Object
  • Object
show all
Defined in:
lib/stupidedi/parser/identifier_stack.rb

Overview

@todo: Documentation

Defined Under Namespace

Classes: Empty, GS, HL, ISA, ST, Sequence

Instance Method Summary collapse

Constructor Details

#initialize(start) ⇒ IdentifierStack

Returns a new instance of IdentifierStack.



9
10
11
# File 'lib/stupidedi/parser/identifier_stack.rb', line 9

def initialize(start)
  @state = Empty.new(Sequence.new(start))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args)



70
71
72
# File 'lib/stupidedi/parser/identifier_stack.rb', line 70

def method_missing(name, *args)
  @state.__send__(name, *args)
end

Instance Method Details

#gs(*args) ⇒ String

Returns a new functional Group Control Number (GS06, GE02)

Returns:

  • (String)


24
25
26
27
# File 'lib/stupidedi/parser/identifier_stack.rb', line 24

def gs(*args)
  @state = @state.gs(*args)
  @state.id
end

#hl(*args) ⇒ String

Returns a new Hierarchical ID Number (HL01)

Returns:

  • (String)


40
41
42
43
# File 'lib/stupidedi/parser/identifier_stack.rb', line 40

def hl(*args)
  @state = @state.hl(*args)
  @state.id
end

#isa(*args) ⇒ String

Returns a new interchange control number (ISA13, IEA02)

Returns:

  • (String)


16
17
18
19
# File 'lib/stupidedi/parser/identifier_stack.rb', line 16

def isa(*args)
  @state = @state.isa(*args)
  @state.id
end

#pop

Returns the last identifier created



46
47
48
# File 'lib/stupidedi/parser/identifier_stack.rb', line 46

def pop
  @state.id.tap { @state = @state.pop }
end

#pop_gs



54
55
56
# File 'lib/stupidedi/parser/identifier_stack.rb', line 54

def pop_gs
  @state.id.tap { @state = @state.pop_gs }
end

#pop_hl



62
63
64
# File 'lib/stupidedi/parser/identifier_stack.rb', line 62

def pop_hl
  @state.id.tap { @state = @state.pop_hl }
end

#pop_isa



50
51
52
# File 'lib/stupidedi/parser/identifier_stack.rb', line 50

def pop_isa
  @state.id.tap { @state = @state.pop_isa }
end

#pop_st



58
59
60
# File 'lib/stupidedi/parser/identifier_stack.rb', line 58

def pop_st
  @state.id.tap { @state = @state.pop_st }
end

#respond_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/stupidedi/parser/identifier_stack.rb', line 66

def respond_to?(name)
  @state.respond_to?(name)
end

#st(*args) ⇒ String

Returns a new Transaction Set Control Number (ST02)

Returns:

  • (String)


32
33
34
35
# File 'lib/stupidedi/parser/identifier_stack.rb', line 32

def st(*args)
  @state = @state.st(*args)
  @state.id
end