Class: Strict::Methods::Module
- Inherits:
-
Module
- Object
- Module
- Strict::Methods::Module
- Defined in:
- lib/strict/methods/module.rb
Instance Attribute Summary collapse
-
#verifiable_method ⇒ Object
readonly
Returns the value of attribute verifiable_method.
Instance Method Summary collapse
-
#initialize(verifiable_method) ⇒ Module
constructor
A new instance of Module.
- #inspect ⇒ Object
Constructor Details
#initialize(verifiable_method) ⇒ Module
Returns a new instance of Module.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/strict/methods/module.rb', line 8 def initialize(verifiable_method) super() @verifiable_method = verifiable_method define_method verifiable_method.name do |*args, **kwargs, &block| args, kwargs = verifiable_method.verify_parameters!(*args, **kwargs) super(*args, **kwargs, &block).tap do |value| verifiable_method.verify_returns!(value) end end end |
Instance Attribute Details
#verifiable_method ⇒ Object (readonly)
Returns the value of attribute verifiable_method.
6 7 8 |
# File 'lib/strict/methods/module.rb', line 6 def verifiable_method @verifiable_method end |
Instance Method Details
#inspect ⇒ Object
21 22 23 |
# File 'lib/strict/methods/module.rb', line 21 def inspect "#<#{self.class} (#{verifiable_method.name})>" end |