Skip to content
This repository
Browse code

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

  • Loading branch information...
commit bfc6750d770b464f588562ee6877df1402ae68af 1 parent e600480
James M. Lawrence authored August 09, 2009
4  lib/quix/vars.rb
@@ -71,11 +71,11 @@ class << self
71 71
         attr_accessor :argument_cache
72 72
         def eval_code
73 73
           code = <<-__b516c3a760b9758a47463bdb3c316bab
74  
-            lambda {
  74
+            class << Object.new
75 75
               #{::Quix::Vars::Private.argument_cache.value}
76 76
 
77 77
               [local_variables, binding]
78  
-            }.call
  78
+            end
79 79
           __b516c3a760b9758a47463bdb3c316bab
80 80
           eval(code, TOPLEVEL_BINDING)
81 81
         end
4  test/vars_test.rb
@@ -3,6 +3,8 @@
3 3
 require 'quix/vars'
4 4
 require 'quix/ruby'
5 5
 
  6
+stray_toplevel_local = 33
  7
+
6 8
 class TestVars < Test::Unit::TestCase
7 9
   include Quix::Vars
8 10
 
@@ -151,5 +153,7 @@ def test_config_to_hash
151 153
     assert_equal(hash[:d].object_id, hash[:d_object_id])
152 154
     assert_equal(hash[:e].object_id, hash[:e_object_id])
153 155
     assert_equal(hash[:f].object_id, hash[:f_object_id])
  156
+
  157
+    assert(!hash.has_key?(:stray_toplevel_local))
154 158
   end
155 159
 end

0 notes on commit bfc6750

Please sign in to comment.
Something went wrong with that request. Please try again.