Permalink
Browse files

vars.rb: config_to_hash no longer includes locals from toplevel binding

  • Loading branch information...
1 parent e600480 commit bfc6750d770b464f588562ee6877df1402ae68af @quix committed Aug 9, 2009
Showing with 6 additions and 2 deletions.
  1. +2 −2 lib/quix/vars.rb
  2. +4 −0 test/vars_test.rb
View
@@ -71,11 +71,11 @@ class << self
attr_accessor :argument_cache
def eval_code
code = <<-__b516c3a760b9758a47463bdb3c316bab
- lambda {
+ class << Object.new
#{::Quix::Vars::Private.argument_cache.value}
[local_variables, binding]
- }.call
+ end
__b516c3a760b9758a47463bdb3c316bab
eval(code, TOPLEVEL_BINDING)
end
View
@@ -3,6 +3,8 @@
require 'quix/vars'
require 'quix/ruby'
+stray_toplevel_local = 33
+
class TestVars < Test::Unit::TestCase
include Quix::Vars
@@ -151,5 +153,7 @@ def test_config_to_hash
assert_equal(hash[:d].object_id, hash[:d_object_id])
assert_equal(hash[:e].object_id, hash[:e_object_id])
assert_equal(hash[:f].object_id, hash[:f_object_id])
+
+ assert(!hash.has_key?(:stray_toplevel_local))
end
end

0 comments on commit bfc6750

Please sign in to comment.