Class: Chitin::Sandbox

Inherits:
Object show all
Defined in:
lib/chitin/sandbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSandbox

Returns a new instance of Sandbox.



5
6
7
8
# File 'lib/chitin/sandbox.rb', line 5

def initialize
  @binding  = binding
  @previous = nil
end

Instance Attribute Details

#previousObject

Returns the value of attribute previous.



3
4
5
# File 'lib/chitin/sandbox.rb', line 3

def previous
  @previous
end

Instance Method Details

#evaluate(code) ⇒ Object



14
15
16
# File 'lib/chitin/sandbox.rb', line 14

def evaluate(code)
  self.previous = eval code, @binding
end

#inspectObject



10
11
12
# File 'lib/chitin/sandbox.rb', line 10

def inspect
  "(sandbox)"
end