Class: Sinclair::MethodDefinition::BlockDefinition Private
- Inherits:
-
Sinclair::MethodDefinition
- Object
- Sinclair::MethodDefinition
- Sinclair::MethodDefinition::BlockDefinition
- Defined in:
- lib/sinclair/method_definition/block_definition.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Define a method from block
Constant Summary
Constants inherited from Sinclair::MethodDefinition
Instance Attribute Summary
Attributes included from OptionsParser
Instance Method Summary collapse
-
#build(klass) ⇒ Symbol
private
Adds the method to given klass.
-
#initialize(name, **options, &block) ⇒ BlockDefinition
constructor
private
A new instance of BlockDefinition.
Methods inherited from Sinclair::MethodDefinition
Methods included from OptionsParser
Constructor Details
#initialize(name, **options, &block) ⇒ BlockDefinition
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of BlockDefinition.
12 13 14 15 |
# File 'lib/sinclair/method_definition/block_definition.rb', line 12 def initialize(name, **, &block) @block = block super(name, **) end |
Instance Method Details
#build(klass) ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds the method to given klass
46 47 48 |
# File 'lib/sinclair/method_definition/block_definition.rb', line 46 def build(klass) klass.send(:define_method, name, method_block) end |