Sha256: 2df7fc45a646796f75874eda3aa0d9a0aa6b6202c3139015ff09283fd1a5cb0c

Contents?: true

Size: 746 Bytes

Versions: 23

Compression:

Stored size: 746 Bytes

Contents

require "active_support/core_ext/hash/deep_merge"

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)
        if arguments.first.is_a?(Proc)
          proc = arguments.pop
          arguments << lambda { |*args| @options.deep_merge(proc.call(*args)) }
        else
          arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup)
        end

        @context.__send__(method, *arguments, &block)
      end
  end
end

Version data entries

23 entries across 23 versions & 3 rubygems

Version Path
activesupport-5.1.7 lib/active_support/option_merger.rb
activesupport-5.1.7.rc1 lib/active_support/option_merger.rb
activesupport-5.1.6.2 lib/active_support/option_merger.rb
activesupport-5.1.6.1 lib/active_support/option_merger.rb
activesupport-5.1.6 lib/active_support/option_merger.rb
tdiary-5.0.8 vendor/bundle/gems/activesupport-5.1.5/lib/active_support/option_merger.rb
activesupport-5.1.5 lib/active_support/option_merger.rb
activesupport-5.1.5.rc1 lib/active_support/option_merger.rb
pract6-0.1.0 .gem/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/option_merger.rb
activesupport-5.1.4 lib/active_support/option_merger.rb
activesupport-5.1.4.rc1 lib/active_support/option_merger.rb
activesupport-5.1.3 lib/active_support/option_merger.rb
activesupport-5.1.3.rc3 lib/active_support/option_merger.rb
activesupport-5.1.3.rc2 lib/active_support/option_merger.rb
activesupport-5.1.3.rc1 lib/active_support/option_merger.rb
tdiary-5.0.5 vendor/bundle/gems/activesupport-5.1.2/lib/active_support/option_merger.rb
activesupport-5.1.2 lib/active_support/option_merger.rb
activesupport-5.1.2.rc1 lib/active_support/option_merger.rb
activesupport-5.1.1 lib/active_support/option_merger.rb
activesupport-5.1.0 lib/active_support/option_merger.rb