Class: Dry::System::Provider::SourceDSL Private
- Inherits:
-
Object
- Object
- Dry::System::Provider::SourceDSL
- Defined in:
- lib/dry/system/provider/source_dsl.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.
Configures a Dry::System::Provider::Source subclass using a DSL that makes it nicer to define source behaviour via a single block.
Instance Attribute Summary collapse
- #source_class ⇒ Object readonly private
Class Method Summary collapse
- .evaluate(source_class) ⇒ Object private
Instance Method Summary collapse
-
#initialize(source_class) ⇒ SourceDSL
constructor
private
A new instance of SourceDSL.
- #prepare ⇒ Object private
- #setting ⇒ Object private
- #start ⇒ Object private
- #stop ⇒ Object private
Constructor Details
#initialize(source_class) ⇒ SourceDSL
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 SourceDSL.
19 20 21 |
# File 'lib/dry/system/provider/source_dsl.rb', line 19 def initialize(source_class) @source_class = source_class end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object (private)
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.
41 42 43 44 45 46 47 |
# File 'lib/dry/system/provider/source_dsl.rb', line 41 def method_missing(name, ...) if source_class.respond_to?(name) source_class.public_send(name, ...) else super end end |
Instance Attribute Details
#source_class ⇒ Object (readonly)
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.
17 18 19 |
# File 'lib/dry/system/provider/source_dsl.rb', line 17 def source_class @source_class end |
Class Method Details
.evaluate(source_class) ⇒ Object
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.
13 14 15 |
# File 'lib/dry/system/provider/source_dsl.rb', line 13 def self.evaluate(source_class, &) new(source_class).instance_eval(&) end |
Instance Method Details
#prepare ⇒ Object
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.
27 28 29 |
# File 'lib/dry/system/provider/source_dsl.rb', line 27 def prepare(&) source_class.define_method(:prepare, &) end |
#setting ⇒ Object
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.
23 24 25 |
# File 'lib/dry/system/provider/source_dsl.rb', line 23 def setting(...) source_class.setting(...) end |
#start ⇒ Object
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.
31 32 33 |
# File 'lib/dry/system/provider/source_dsl.rb', line 31 def start(&) source_class.define_method(:start, &) end |
#stop ⇒ Object
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.
35 36 37 |
# File 'lib/dry/system/provider/source_dsl.rb', line 35 def stop(&) source_class.define_method(:stop, &) end |