mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
d6925b14fa
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5197 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
25 lines
654 B
Ruby
25 lines
654 B
Ruby
module ActiveSupport
|
|
class OptionMerger #:nodoc:
|
|
instance_methods.each do |method|
|
|
undef_method(method) if method !~ /^(__|instance_eval|class)/
|
|
end
|
|
|
|
def initialize(context, options)
|
|
@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)
|
|
else
|
|
@options.dup
|
|
end
|
|
end
|
|
end
|
|
end
|