Skip to content

Instantly share code, notes, and snippets.

@akiray03
Last active December 21, 2015 15:38
Show Gist options
  • Select an option

  • Save akiray03/6327546 to your computer and use it in GitHub Desktop.

Select an option

Save akiray03/6327546 to your computer and use it in GitHub Desktop.
$ ruby t.rb
OK
$ ./tmp/mruby/bin/mruby t.rb
not found class A
t.rb:11: uninitialized constant A (NameError)
$ ./tmp/mruby/bin/mruby t2.rb
OK
class A
end
module Kernel
def hoge
A # found class A
begin
['a'].each do |i|
A # not found class A
puts "OK"
end
rescue NameError => e
puts "not found class A"
p e
end
end
end
hoge
class A
end
module Hoge
def hoge
A # found class A
begin
['a'].each do |i|
A # not found class A
puts "OK"
end
rescue NameError => e
puts "not found class A"
p e
end
end
end
include Hoge
hoge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment