Sha256: 98274e972784bc28d494b6f61ae44883c89190cc43ed18609ee96d7a97787900
Contents?: true
Size: 650 Bytes
Versions: 3
Compression:
Stored size: 650 Bytes
Contents
# -*- encoding : utf-8 -*- module Pacto class ContractNotFound < StandardError; end class ContractRegistry < Set include Logger def register(contract) fail ArgumentError, 'expected a Pacto::Contract' unless contract.is_a? Contract logger.debug "Registering #{contract.request_pattern} as #{contract.name}" add contract end def find_by_name(name) contract = select { |c| c.name == name }.first fail ContractNotFound, "No contract found for #{name}" unless contract contract end def contracts_for(request_signature) select { |c| c.matches? request_signature } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pacto-0.4.0.rc3 | lib/pacto/core/contract_registry.rb |
pacto-0.4.0.rc2 | lib/pacto/core/contract_registry.rb |
pacto-0.4.0.rc1 | lib/pacto/core/contract_registry.rb |