Sha256: 4441656854757c70e8ec1ebadfc30d2d572eee84d89e5693a108b8f0448316b5
Contents?: true
Size: 701 Bytes
Versions: 1
Compression:
Stored size: 701 Bytes
Contents
module Flea class Environment attr_accessor :parent def initialize(parent = nil) @parent = parent @table = {} add_globals if @parent.nil? end def has_variable?(name) return true if @table.has_key?(name) return false if @parent.nil? return @parent.has_variable?(name) end def find(name) return @table[name] if @table.has_key?(name) return nil if @parent.nil? return @parent.find(name) end def define(name, value) @table[name] = value end private def add_globals @table.merge!({ :"#t" => true, :"#f" => false }) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flea-0.1.0 | lib/flea/environment.rb |