Module: Contracts::SingletonClassMethods
- Defined in:
- lib/contracts.rb
Instance Method Summary collapse
Instance Method Details
#contract_singleton(name, **options) ⇒ Object
958 959 960 961 |
# File 'lib/contracts.rb', line 958 def contract_singleton(name, **, &) singleton_class.extend(ClassMethods) singleton_class.declare_contract(name, :singleton, , &) end |
#singleton_method_added(name) ⇒ Object
963 964 965 966 967 968 969 |
# File 'lib/contracts.rb', line 963 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 |