Sha256: 6eddedab620dc789e2b4988fbf06a0078baadd6d1c5a488ae338c17f0be189dd

Contents?: true

Size: 407 Bytes

Versions: 3

Compression:

Stored size: 407 Bytes

Contents

# Pops the top +:name+ item, and if it is bound to a name (a local, not a variable)
# it removes that binding.
#
# needs: 1 +:name+
#
# pushes: nothing

class NameUnbindInstruction < Instruction
  def preconditions?
    needs :name,1
  end
  
  def setup
    @arg1 = @context.pop(:name)
  end
  
  def derive
    @lost_name = @arg1.name
  end
  
  def cleanup
    @context.unbind_name(@lost_name)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nudge-0.2.9 lib/instructions/name/name_unbind.rb
nudge-0.2.8 lib/instructions/name/name_unbind.rb
nudge-0.2.7 lib/instructions/name/name_unbind.rb