Sha256: 10a2f991b49bbc77ac6d3e67ae3478f0d336a82c193c8bfbc7c24741c166b467

Contents?: true

Size: 443 Bytes

Versions: 3

Compression:

Stored size: 443 Bytes

Contents

# encoding: utf-8

# pops the top +:name+ item;
# pushes a new +:code+ item,
# with value equal to the +:name+ item's blueprint
#
# *needs:* 1 +:name+
#
# *pushes:* 1 +:code+
#

class CodeFromNameInstruction < Instruction
  def preconditions?
    needs :name, 1
  end
  def setup
    @arg = @context.pop(:name).name
  end
  def derive
    @result = ValuePoint.new("code", "ref #{@arg}")
  end
  def cleanup
    pushes :code, @result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nudge-0.2.9 lib/instructions/conversion/code_from_name.rb
nudge-0.2.8 lib/instructions/conversion/code_from_name.rb
nudge-0.2.7 lib/instructions/conversion/code_from_name.rb