From bbdd6e930fc11a7ddb03d25cc2af8845aee24700 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 9 Jul 2013 20:11:15 -0400 Subject: [PATCH] use default Environment.new, check block_given?() from initialize() --- lib/rscons/environment.rb | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index 8168378..938e781 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -4,19 +4,6 @@ module Rscons class Environment attr_reader :builders - class << self - alias_method :orig_new, :new - end - - def self.new(*args) - e = Environment.orig_new(*args) - if block_given? - yield e - e.process - end - e - end - # Initialize a newly constructed Environment object # === Arguments # +variables+ _Hash_ :: @@ -40,6 +27,11 @@ module Rscons add_builder(builder) end @variables[:echo] ||= :command + + if block_given? + yield self + self.process + end end def add_builder(builder)