Module: Contracts::SingletonClassMethods
- Defined in:
- lib/contracts.rb
Instance Method Summary collapse
Instance Method Details
#contract_singleton(name, **options) ⇒ Object
1050 1051 1052 1053 |
# File 'lib/contracts.rb', line 1050 def contract_singleton(name, **, &) singleton_class.extend(ClassMethods) singleton_class.declare_contract(name, :singleton, , &) end |
#singleton_method_added(name) ⇒ Object
1055 1056 1057 1058 1059 1060 1061 |
# File 'lib/contracts.rb', line 1055 def singleton_method_added(name) return if @__contracts_hook contract = Contracts.registry.find(singleton_class, name, method_type: :singleton) singleton_class.wrap_contract(name, contract) if contract && contract.owner == singleton_class super end |