2 class OptionMerger
#:nodoc:
3 instance_methods
.each
do |method
|
4 undef_method(method
) if method
!~
/^(__|instance_eval|class|object_id)/
7 def initialize(context
, options
)
8 @context, @options = context
, options
12 def method_missing(method
, *arguments
, &block
)
13 if arguments
.last
.is_a
?(Proc
)
15 arguments
<< lambda
{ |*args
| @options.deep_merge(proc
.call(*args
)) }
17 arguments
<< (arguments
.last
.respond_to
?(:to_hash) ? @options.deep_merge(arguments
.pop
) : @options.dup
)
20 @context.__send__(method
, *arguments
, &block
)