Class: Sinclair::MethodDefinition Private
- Inherits:
-
Object
- Object
- Sinclair::MethodDefinition
- Includes:
- OptionsParser
- Defined in:
- lib/sinclair/method_definition.rb,
lib/sinclair/method_definition/block_definition.rb,
lib/sinclair/method_definition/string_definition.rb,
lib/sinclair/method_definition/class_block_definition.rb,
lib/sinclair/method_definition/class_method_definition.rb,
lib/sinclair/method_definition/class_string_definition.rb,
lib/sinclair/method_definition/instance_block_definition.rb,
lib/sinclair/method_definition/instance_method_definition.rb,
lib/sinclair/method_definition/instance_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.
Definition of the code or block to be aded as method
Direct Known Subclasses
Defined Under Namespace
Modules: ClassMethodDefinition, InstanceMethodDefinition Classes: BlockDefinition, ClassBlockDefinition, ClassStringDefinition, InstanceBlockDefinition, InstanceStringDefinition, StringDefinition
Constant Summary collapse
- DEFAULT_OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Default options of initialization
{ cached: false }.freeze
Instance Attribute Summary
Attributes included from OptionsParser
Instance Method Summary collapse
-
#build(_klass) ⇒ Symbol
abstract
private
Adds the method to given klass.
-
#initialize(name, **options) ⇒ MethodDefinition
constructor
private
A new instance of MethodDefinition.
Methods included from OptionsParser
Constructor Details
#initialize(name, **options) ⇒ MethodDefinition
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 MethodDefinition.
29 30 31 32 |
# File 'lib/sinclair/method_definition.rb', line 29 def initialize(name, **) @name = name @options = DEFAULT_OPTIONS.merge() 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
This should be implemented on child classes
46 47 48 49 |
# File 'lib/sinclair/method_definition.rb', line 46 def build(_klass) raise 'Build is implemented in subclasses. ' \ "Use #{self.class}.from to initialize a proper object" end |