Sha256: 94800739e5606142d35f2e36914eba888235d6f1457f4c06bcbd6cc78563ea19
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
# frozen_string_literal: true module Tataru # a thing to do class Instruction class << self attr_accessor :expected_params def expects(symbol) @expected_params ||= [] @expected_params << symbol define_method symbol do return nil if @memory&.hash.nil? memory.hash[:temp][symbol] end end end attr_accessor :memory def execute(memory) @memory = memory self.class.expected_params&.each do |symbol| unless memory.hash[:temp].key? symbol raise "required param #{symbol} not found" end end run end def run; end end end require 'tataru/instructions/immediate_mode_instruction' require 'tataru/instructions/resource_instruction' require 'tataru/instructions/check_instruction' require 'tataru/instructions/check_delete_instruction' require 'tataru/instructions/mark_deletable_instruction' require 'tataru/instructions/clear_instruction' require 'tataru/instructions/goto_if_instruction' require 'tataru/instructions/key_instruction' require 'tataru/instructions/value_rom_instruction' require 'tataru/instructions/value_update_instruction' require 'tataru/instructions/compare_instruction' require 'tataru/instructions/delete_instruction' require 'tataru/instructions/update_instruction' require 'tataru/instructions/create_instruction' require 'tataru/instructions/end_instruction' require 'tataru/instructions/check_create_instruction' require 'tataru/instructions/read_instruction' require 'tataru/instructions/check_update_instruction' require 'tataru/instructions/rescmp_instruction' require 'tataru/instructions/call_instruction' require 'tataru/instructions/value_instruction' require 'tataru/instructions/return_instruction' require 'tataru/instructions/init_instruction'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tataru-0.2.0 | lib/tataru/instruction.rb |