ary = [] | |
class Test | |
def self.run &block | |
define_method :run_method do | |
# ary is in scope | |
self.instance_eval &block | |
end | |
Test.new.run_method | |
end | |
end | |
Test.run do | |
ary << 1 | |
puts 'complete' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment