Skip to content
Permalink
Browse files
Some of a new sandbox
  • Loading branch information
orangea committed Sep 26, 2009
1 parent 6699c79 commit 01580316348e0f233044a6202c0dbbfea3cdb98e
Showing 1 changed file with 53 additions and 0 deletions.
@@ -0,0 +1,53 @@
class FakeStdout
attr_accessor :calls
def initialize
@calls = []
@string = ""
end

def method_missing(method, *args)
@calls << {method: method, args: args}
end

def write(str)
@string += str

method_missing(:write, strs)
end

def to_s
return "" if @calls.empty?
@string
# @calls.join("\n")
end
end

class Object
attr_reader :tryruby_line, :tryruby_past_commands, :tryruby_current_includes
@tryruby_line, @tryruby_past_commands, @tryruby_current_includes = ARGV
end
ARGV = []

poem = <<POEM_EOF
blah blah blah
POEM_EOF

def require(path)
result = ''
path = path.sub(/\.rb$/, "")
return false unless ['popup'].include?(path)
if Object.tryruby_current_includes.include?(path)

else
Thread.new do
result = File.read(path)
Object.tryruby_current_includes << path
end
end
true
end

$stdout = FakeStdout.new

eval( <<EOF
$SAFE=3

0 comments on commit 0158031

Please sign in to comment.