Sha256: e886cc3024e5c6eb5d0b3cc49415ae138ed09a2341eb5c99f5cf2e7ff00df543

Contents?: true

Size: 741 Bytes

Versions: 35

Compression:

Stored size: 741 Bytes

Contents

class Pry
  module Forwardable
    require 'forwardable'
    include ::Forwardable

    #
    # Since Ruby 2.4, Forwardable will print a warning when
    # calling a method that is private on a delegate, and
    # in the future it could be an error: https://bugs.ruby-lang.org/issues/12782#note-3
    #
    # That's why we revert to a custom implementation for delegating one
    # private method to another.
    #
    def def_private_delegators(target, *private_delegates)
      private_delegates.each do |private_delegate|
        define_method(private_delegate) do |*a, &b|
          instance_variable_get(target).__send__(private_delegate, *a, &b)
        end
      end
      class_eval { private(*private_delegates) }
    end
  end
end

Version data entries

35 entries across 35 versions & 14 rubygems

Version Path
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/forwardable.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/pry-0.12.2/lib/pry/forwardable.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/pry-0.12.2/lib/pry/forwardable.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/forwardable.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/pry-0.12.2/lib/pry/forwardable.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/pry-0.11.3/lib/pry/forwardable.rb
chess_engine-0.0.2 vendor/bundle/gems/pry-0.12.2/lib/pry/forwardable.rb
chess_engine-0.0.1 vendor/bundle/gems/pry-0.12.2/lib/pry/forwardable.rb
xaiml-0.1.3 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/forwardable.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/forwardable.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/pry-0.12.2/lib/pry/forwardable.rb
xaiml-0.1.2 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/forwardable.rb
pry-0.12.2-java lib/pry/forwardable.rb
pry-0.12.2 lib/pry/forwardable.rb
pry-0.12.1 lib/pry/forwardable.rb
pry-0.12.1-java lib/pry/forwardable.rb
pry-0.12.0 lib/pry/forwardable.rb
pry-0.12.0-java lib/pry/forwardable.rb
xaiml-0.1.1 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/forwardable.rb
xaiml-0.1.0 vendor/bundle/ruby/2.5.0/gems/pry-0.11.3/lib/pry/forwardable.rb