so close i can smell it, checkpoint
This commit is contained in:
@@ -5,28 +5,13 @@ module Vm
|
||||
|
||||
#currently just holding the program in here so we can have global access
|
||||
class Context
|
||||
# Make hash attributes to object attributes
|
||||
include Support::HashAttributes
|
||||
|
||||
def initialize program
|
||||
@attributes = {}
|
||||
@attributes["program"] = program
|
||||
end
|
||||
|
||||
# map any function call to an attribute if possible
|
||||
def method_missing name , *args , &block
|
||||
if args.length > 1 or block_given?
|
||||
puts "NO -#{args.length} BLOCK #{block_given?}"
|
||||
super
|
||||
else
|
||||
name = name.to_s
|
||||
if args.length == 1 #must be assignemnt for ir attr= val
|
||||
if name.include? "="
|
||||
return @attributes[name.chop] = args[0]
|
||||
else
|
||||
super
|
||||
end
|
||||
else
|
||||
return @attributes[name]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user