Class: Moltrio::Config::Scoped
- Inherits:
-
Adapter
- Object
- Adapter
- Moltrio::Config::Scoped
show all
- Defined in:
- lib/moltrio/config/adapters/scoped.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Adapter
#[], #[]=, #available_namespaces, #fetch, #fetch_all, #has_key?, #slice
Constructor Details
#initialize(base, scope) ⇒ Scoped
Returns a new instance of Scoped.
14
15
16
17
|
# File 'lib/moltrio/config/adapters/scoped.rb', line 14
def initialize(base, scope)
@base = base
@scope = scope
end
|
Class Method Details
.delegate_to_base_scoping_first_argument(*delegations) ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/moltrio/config/adapters/scoped.rb', line 20
def delegate_to_base_scoping_first_argument(*delegations)
delegations.each do |method|
define_method(method) do |key, *args, &block|
key = scope_key(key)
base.public_send(method, key, *args, &block)
end
end
end
|
Instance Method Details
#missing_namespace? ⇒ Boolean
38
39
40
|
# File 'lib/moltrio/config/adapters/scoped.rb', line 38
def missing_namespace?
base.missing_namespace?
end
|
#on_namespace(name) ⇒ Object
34
35
36
|
# File 'lib/moltrio/config/adapters/scoped.rb', line 34
def on_namespace(name)
self.class.new(base.on_namespace(name), scope)
end
|
#scoped(scope) ⇒ Object
30
31
32
|
# File 'lib/moltrio/config/adapters/scoped.rb', line 30
def scoped(scope)
self.class.new(base, scope_key(scope))
end
|