lib/active_scaffold/configurable.rb in active_scaffold-3.4.17 vs lib/active_scaffold/configurable.rb in active_scaffold-3.4.18
- old
+ new
@@ -5,25 +5,23 @@
#
# May add the given functionality at both the class and instance level. For the former, use +extend+, and for the latter, use +include+.
module Configurable
def configure(&configuration_block)
return unless configuration_block
- @configuration_binding = eval("self", configuration_block.binding)
- ret = instance_exec self, &configuration_block
+ @configuration_binding = configuration_block.binding.eval('self')
+ ret = instance_exec(self, &configuration_block)
@configuration_binding = nil
- return ret
+ ret
end
# this method will surely need tweaking. for example, i'm not sure if it should call super before or after it tries to eval with the binding.
def method_missing(name, *args)
- begin
- super
- rescue NoMethodError, NameError
- if @configuration_binding.nil?
- raise $!
- else
- @configuration_binding.send(name, *args)
- end
+ super
+ rescue NoMethodError, NameError
+ if @configuration_binding.nil?
+ raise
+ else
+ @configuration_binding.send(name, *args)
end
end
end
end