Module: Ree::Contracts::Contractable
- Defined in:
- lib/ree/contracts/contractable.rb
Instance Method Summary collapse
- #contract(*args, &block) ⇒ Object
- #doc(str) ⇒ Object
- #method_added(name) ⇒ Object
- #singleton_method_added(name) ⇒ Object
Instance Method Details
#contract(*args, &block) ⇒ Object
26 27 28 29 30 |
# File 'lib/ree/contracts/contractable.rb', line 26 def contract(*args, &block) engine = Engine.fetch_for(self) engine.add_contract(*args, &block) EngineProxy.new(engine) end |
#doc(str) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/ree/contracts/contractable.rb', line 19 def doc(str) return if Ree::Contracts.no_contracts? engine = Engine.fetch_for(self) engine.add_doc(str.strip) end |
#method_added(name) ⇒ Object
9 10 11 12 |
# File 'lib/ree/contracts/contractable.rb', line 9 def method_added(name) MethodDecorator.new(name, false, self).call super end |
#singleton_method_added(name) ⇒ Object
14 15 16 17 |
# File 'lib/ree/contracts/contractable.rb', line 14 def singleton_method_added(name) MethodDecorator.new(name, true, self).call super end |