Sha256: ef30ceed15131f592c20ee766e3af8f348e3056e2b9b1f87ce7916ef6c8ec74f

Contents?: true

Size: 738 Bytes

Versions: 42

Compression:

Stored size: 738 Bytes

Contents

module Eco
  module Language
    module Methods
      module DelegateMissing
        def delegate_missing_to(meth)
          @delegate_missing_to = meth
        end

        def method_missing(method_name, *args, **kargs, &block)
          super unless receiver = object_missing_delegated_to
          receiver.send(method_name, *args, **kargs, &block)
        end

        def respond_to_missing?(method_name, include_private = false)
          super
        end

        private

        # retrieve the delegate_missing_to object
        def object_missing_delegated_to
          return nil unless @delegate_missing_to
          self.method(@delegate_missing_to).call
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
eco-helpers-2.7.25 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.24 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.23 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.22 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.21 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.20 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.19 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.18 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.17 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.16 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.15 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.14 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.13 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.12 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.4 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.2 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.1 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.7.0 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.6.4 lib/eco/language/methods/delegate_missing.rb
eco-helpers-2.6.3 lib/eco/language/methods/delegate_missing.rb