aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/lib/active_support/option_merger.rb
blob: c77bca1ac9fae40258d8d69e1f2afb4dd3c44bab (plain) (tree)
1
2
3
4
5
6
7
8
9

                             
                                     
                                                                             
       
 


                                           
 

                                                    
                                                                                                               
                                                  
         

     
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