Module: Contracts::MethodDecorators

Defined in:
lib/contracts-ruby2/lib/contracts/decorators.rb,
lib/contracts-ruby3/lib/contracts/decorators.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object



3
4
5
# File 'lib/contracts-ruby2/lib/contracts/decorators.rb', line 3

def self.extended(klass)
  Engine.apply(klass)
end

Instance Method Details

#inherited(subclass) ⇒ Object



7
8
9
10
# File 'lib/contracts-ruby2/lib/contracts/decorators.rb', line 7

def inherited(subclass)
  Engine.fetch_from(subclass).set_eigenclass_owner
  super
end

#method_added(name) ⇒ Object



12
13
14
15
# File 'lib/contracts-ruby2/lib/contracts/decorators.rb', line 12

def method_added(name)
  MethodHandler.new(name, false, self).handle
  super
end

#singleton_method_added(name) ⇒ Object



17
18
19
20
# File 'lib/contracts-ruby2/lib/contracts/decorators.rb', line 17

def singleton_method_added(name)
  MethodHandler.new(name, true, self).handle
  super
end