aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/build_environment.rb
diff options
context:
space:
mode:
authorJack Nagel2013-01-19 20:45:58 -0600
committerJack Nagel2013-01-21 17:24:11 -0600
commit2503cedf2c9ebb7e15029f126518f42ff0e5ee1c (patch)
treefb597e1412d419598001f9d5716def2fc681a37a /Library/Homebrew/build_environment.rb
parentc53af4211704c9f08366de5eb22251e5ffb4bdd5 (diff)
downloadbrew-2503cedf2c9ebb7e15029f126518f42ff0e5ee1c.tar.bz2
Object#instance_exec for Ruby 1.8.6
Not thread safe! But I don't think we care. We want to evaluate the env DSL block in the context of ENV for asthetic reasons, but we also want access to methods on the requirement instance. We can use #instance_exec to pass the requirement itself into the block: class Foo < Requirement env do |req| append 'PATH', req.some_path end def some_path which 'something' end end Also add a simplified version of Object#instance_exec for Ruby 1.8.6.
Diffstat (limited to 'Library/Homebrew/build_environment.rb')
-rw-r--r--Library/Homebrew/build_environment.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/Library/Homebrew/build_environment.rb b/Library/Homebrew/build_environment.rb
index 18876f954..60e099977 100644
--- a/Library/Homebrew/build_environment.rb
+++ b/Library/Homebrew/build_environment.rb
@@ -18,9 +18,9 @@ class BuildEnvironment
@settings.include? :userpaths
end
- def modify_build_environment
+ def modify_build_environment(context=nil)
p = @settings.find { |s| Proc === s }
- ENV.instance_eval(&p) unless p.nil?
+ ENV.instance_exec(context, &p) unless p.nil?
end
def _dump(*)