Class: Sinclair::MethodDefinition::StringDefinition Private
- Inherits:
-
Sinclair::MethodDefinition
- Object
- Sinclair::MethodDefinition
- Sinclair::MethodDefinition::StringDefinition
- Defined in:
- lib/sinclair/method_definition/string_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 string
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, code = nil, **options) ⇒ StringDefinition
constructor
private
A new instance of StringDefinition.
Methods inherited from Sinclair::MethodDefinition
Methods included from OptionsParser
Constructor Details
#initialize(name, code = nil, **options) ⇒ StringDefinition
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 StringDefinition.
12 13 14 15 |
# File 'lib/sinclair/method_definition/string_definition.rb', line 12 def initialize(name, code = nil, **) @code = code 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/string_definition.rb', line 46 def build(klass) klass.module_eval(code_definition, __FILE__, __LINE__ + 1) end |