Sha256: 4cd4043660876ee3fd2bb62e6ac39c77b6e363ee3787bcdbfeb0bdf3bd332ea4

Contents?: true

Size: 829 Bytes

Versions: 3

Compression:

Stored size: 829 Bytes

Contents

# frozen_string_literal: true

require "docile/fallback_context_proxy"

module Docile
  # @api private
  #
  # Operates in the same manner as {FallbackContextProxy}, but replacing
  # the primary `receiver` object with the result of each proxied method.
  #
  # This is useful for implementing DSL evaluation for immutable context
  # objects.
  #
  # @see Docile.dsl_eval_immutable
  #
  # rubocop:disable Style/MissingRespondToMissing
  class ChainingFallbackContextProxy < FallbackContextProxy
    # Proxy methods as in {FallbackContextProxy#method_missing}, replacing
    # `receiver` with the returned value.
    def method_missing(method, *args, &block)
      @__receiver__ = super
    end

    ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true)
  end
  # rubocop:enable Style/MissingRespondToMissing
end

Version data entries

3 entries across 2 versions & 2 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/docile-1.4.1/lib/docile/chaining_fallback_context_proxy.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/docile-1.4.1/lib/docile/chaining_fallback_context_proxy.rb
docile-1.4.1 lib/docile/chaining_fallback_context_proxy.rb