vendor/rails/activesupport/lib/active_support/option_merger.rb in radiant-0.7.2 vs vendor/rails/activesupport/lib/active_support/option_merger.rb in radiant-0.8.0
- old
+ new
@@ -8,18 +8,16 @@
@context, @options = context, options
end
private
def method_missing(method, *arguments, &block)
- merge_argument_options! arguments
- @context.send!(method, *arguments, &block)
- end
-
- def merge_argument_options!(arguments)
- arguments << if arguments.last.respond_to? :to_hash
- @options.merge(arguments.pop)
+ if arguments.last.is_a?(Proc)
+ proc = arguments.pop
+ arguments << lambda { |*args| @options.deep_merge(proc.call(*args)) }
else
- @options.dup
+ arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup)
end
+
+ @context.__send__(method, *arguments, &block)
end
end
end