Sha256: 1d2a412b7ff63379ba4c5b615dfb5184d55ed1e643dd54d5379e94c460925985

Contents?: true

Size: 652 Bytes

Versions: 2

Compression:

Stored size: 652 Bytes

Contents

module ActiveSupport
  class OptionMerger #:nodoc:
    instance_methods.each do |method| 
      undef_method(method) if method !~ /^(__|instance_eval)/
    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? :merge!
          arguments.pop.dup.merge!(@options)
        else
          @options.dup
        end  
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activesupport-1.3.1 lib/active_support/option_merger.rb
activesupport-1.3.0 lib/active_support/option_merger.rb