Class: Stupidedi::Builder::IdentifierStack::HL

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, id) ⇒ HL

Returns a new instance of HL.



141
142
143
# File 'lib/stupidedi/builder/identifier_stack.rb', line 141

def initialize(parent, id)
  @parent, @id, @sequence = parent, id, id
end

Instance Attribute Details

#sequence=(value) ⇒ Object (writeonly)

Sets the attribute sequence

Parameters:

  • value

    the value to set the attribute sequence to.



139
140
141
# File 'lib/stupidedi/builder/identifier_stack.rb', line 139

def sequence=(value)
  @sequence = value
end

Instance Method Details

#hlObject



145
146
147
# File 'lib/stupidedi/builder/identifier_stack.rb', line 145

def hl
  HL.new(self, @sequence += 1)
end

#idObject



149
150
151
# File 'lib/stupidedi/builder/identifier_stack.rb', line 149

def id
  @id.to_s
end

#parentObject

Parent HL number



154
155
156
157
158
159
# File 'lib/stupidedi/builder/identifier_stack.rb', line 154

def parent
  case @parent
  when HL
    @parent.id
  end
end

#popObject



161
162
163
164
# File 'lib/stupidedi/builder/identifier_stack.rb', line 161

def pop
  @parent.sequence = @sequence
  @parent
end