Skip to content

Commit

Permalink
Modified examples to reproduce the error
Browse files Browse the repository at this point in the history
Just run these 2 commands
$ examples/program2-no-wrapper.rb # without script
$ examples/program2.rb            # with script
  • Loading branch information
dreamcat4 committed Jul 13, 2010
1 parent 132b4ae commit 0a89728
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
12 changes: 12 additions & 0 deletions examples/program2-no-wrapper.rb
@@ -0,0 +1,12 @@
#!/usr/bin/env ruby
INPUT = 3
require File.dirname(__FILE__)+'/scripts/script.rb'

# raise if defined?(INPUT)

p OUTPUT
p MORE_OUTPUT

run

puts "x = #{x}"
5 changes: 5 additions & 0 deletions examples/scripts/lib/a-class.rb
@@ -0,0 +1,5 @@

module BaseModule
class A < BaseClass
end
end
11 changes: 9 additions & 2 deletions examples/scripts/script.rb
Expand Up @@ -4,8 +4,15 @@

OUTPUT = ["input was #{INPUT}"]

require 'lib/x-accessor'
require 'lib/x-accessor' # only loaded once
module BaseModule
class BaseClass
end
end

require File.dirname(__FILE__)+'/lib/a-class'

require File.dirname(__FILE__)+'/lib/x-accessor'
require File.dirname(__FILE__)+'/lib/x-accessor' # only loaded once

# Falls back to Kernel.load, since "benchmark.rb" isn't in the current dir.
load "benchmark.rb" unless $LOADED_FEATURES.include?("benchmark.rb")
Expand Down

0 comments on commit 0a89728

Please sign in to comment.