File: chaining_fallback_context_proxy.rb

package info (click to toggle)
ruby-docile 1.1.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 156 kB
  • sloc: ruby: 374; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 643 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
  class ChainingFallbackContextProxy < FallbackContextProxy
    # Proxy methods as in {FallbackContextProxy#method_missing}, replacing
    # `receiver` with the returned value.
    def method_missing(method, *args, &block)
      @__receiver__ = super(method, *args, &block)
    end
  end
end