mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
40dbebba28
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
17 lines
514 B
Ruby
17 lines
514 B
Ruby
module ActiveSupport
|
|
class OptionMerger #:nodoc:
|
|
instance_methods.each do |method|
|
|
undef_method(method) if method !~ /^(__|instance_eval|class|object_id)/
|
|
end
|
|
|
|
def initialize(context, options)
|
|
@context, @options = context, options
|
|
end
|
|
|
|
private
|
|
def method_missing(method, *arguments, &block)
|
|
arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup)
|
|
@context.send!(method, *arguments, &block)
|
|
end
|
|
end
|
|
end
|