X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Factivesupport%2Flib%2Factive_support%2Foption_merger.rb;fp=vendor%2Frails%2Factivesupport%2Flib%2Factive_support%2Foption_merger.rb;h=b563b093ed4ed0148c3f9e07e471bfa1593821a1;hb=d115f2e23823271635bad69229a42cd8ac68debe;hp=0000000000000000000000000000000000000000;hpb=37cb670bf3ddde90b214e591f100ed4446469484;p=depot.git diff --git a/vendor/rails/activesupport/lib/active_support/option_merger.rb b/vendor/rails/activesupport/lib/active_support/option_merger.rb new file mode 100644 index 0000000..b563b09 --- /dev/null +++ b/vendor/rails/activesupport/lib/active_support/option_merger.rb @@ -0,0 +1,17 @@ +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