Sha256: 3489eff728cd5043be2b367f4faf3d5ffac53daa02ef542e405f0e3c3ce9304c

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

module Tcl
  module Ruby
    class Interpreter
      def initialize
        @variables = {}
        @global = @variables
        @v_stack = []
        @hooks = {}
        @proc = {}
      end

      def variables(arg)
        raise(TclVariableNotFoundError, "can't read $#{arg}, no such variables") unless @variables.key?(arg)
        @variables[arg]
      end

      def add_hook(name, &block)
        raise(ArgumentError, 'block is not given') unless block_given?
        @hooks[name.to_s] = block
      end

      def delete_hook(name)
        @hooks.delete(name.to_s)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tcl-ruby-0.1.0 lib/tcl/ruby/util.rb