Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |