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 an instance method from string
Constant Summary
Constants inherited from Sinclair::MethodDefinition
Instance Attribute Summary
Attributes inherited from Sinclair::MethodDefinition
Attributes included from OptionsParser
Instance Method Summary collapse
-
#build(klass, type) ⇒ Symbol
private
Builds the method defined.
-
#code_line ⇒ String
private
codeline to be run inside the code.
-
#initialize(name, code = nil, **options) ⇒ StringDefinition
constructor
private
A new instance of StringDefinition.
Methods inherited from Sinclair::MethodDefinition
build_with, default_value, for, from
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.
17 18 19 20 |
# File 'lib/sinclair/method_definition/string_definition.rb', line 17 def initialize(name, code = nil, **) @code = code super(name, **) end |
Instance Method Details
#build(klass, type) ⇒ 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.
Builds the method defined
The method is built using Sinclair::MethodBuilder::StringMethodBuilder
10 |
# File 'lib/sinclair/method_definition/string_definition.rb', line 10 build_with MethodBuilder::StringMethodBuilder |
#code_line ⇒ String
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.
codeline to be run inside the code
28 29 30 |
# File 'lib/sinclair/method_definition/string_definition.rb', line 28 def code_line cached? ? code_with_cache : code end |