Sha256: 3ac45d1948c921dfe98196ec2a7c1e47f45380cd0a890f76ef593e0ba2fac420
Contents?: true
Size: 930 Bytes
Versions: 1
Compression:
Stored size: 930 Bytes
Contents
module DesignByContract extend(self) autoload :Interface, 'design_by_contract/interface' autoload :Pattern, 'design_by_contract/pattern' autoload :Signature, 'design_by_contract/signature' def forget_contract_specifications! contracts.keys.each(&:down) contracts.clear nil end def enable_defensive_contract @defensive_contract = true fulfill_contracts! end def as_dependency_injection_for(klass, initialize_signature_spec) register_contract DesignByContract::Pattern::DependencyInjection.new(klass, initialize_signature_spec) end private def contracts @__contracts__ ||= {} end def register_contract(contract) contracts[contract] = :inactive fulfill_contracts! if @defensive_contract end def fulfill_contracts! contracts.each do |contract, state| next if state == :active contract.up contracts[contract] = :active end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
design_by_contract-0.2.0 | lib/design_by_contract.rb |