Class: Evil::Client::DSL::Scope
- Inherits:
-
Object
- Object
- Evil::Client::DSL::Scope
- Extended by:
- Dry::Initializer::Mixin
- Defined in:
- lib/evil/client/dsl/scope.rb
Overview
Provides a namespace for client’s top-level DSL
Class Method Summary collapse
-
.scope(name = :[], &block) ⇒ self
Declares a method that opens new scope inside the current one An instance of new scope has access to methods of its parent.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
29 30 31 32 |
# File 'lib/evil/client/dsl/scope.rb', line 29 def method_missing(name, *args) super unless respond_to? name __scope__.send(name, *args) end |
Class Method Details
.scope(name = :[], &block) ⇒ self
Declares a method that opens new scope inside the current one An instance of new scope has access to methods of its parent
13 14 15 16 17 18 19 |
# File 'lib/evil/client/dsl/scope.rb', line 13 def self.scope(name = :[], &block) klass = Class.new(Scope, &block) define_method(name) do |*args, **| klass.new(*args, __scope__: self, **) end self end |