module Dry::Protocol

rubocop:enable Style/EmptyCaseCondition rubocop:enable Style/AsciiIdentifiers

Public Class Methods

defimpl(protocol = nil, target: nil, delegate: [], map: {}, &λ) click to toggle source

rubocop:disable Style/AsciiIdentifiers

# File lib/dry/behaviour.rb, line 27
def defimpl(protocol = nil, target: nil, delegate: [], map: {}, &λ)
  Dry::BlackTie.defimpl(protocol, target: target, delegate: delegate, map: map, &λ)
end
implemented_for?(protocol, receiver) click to toggle source

rubocop:disable Style/RaiseArgs

# File lib/dry/behaviour.rb, line 33
def implemented_for?(protocol, receiver)
  raise ::Dry::Protocol::NotProtocol.new(protocol) unless protocol < ::Dry::Protocol
  !protocol.implementation_for(receiver).nil?
end
included(base) click to toggle source
# File lib/dry/behaviour.rb, line 21
def self.included(base)
  base.singleton_class.prepend(::Dry::BlackTie)
end