Class: Moneta::Namespace
- Inherits:
-
Object
show all
- Defined in:
- lib/whiplash/app/moneta/namespace.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(store, ns) ⇒ Namespace
Returns a new instance of Namespace.
5
6
7
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 5
def initialize store, ns
@moneta_store, @ns = store, ns
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, args) ⇒ Object
41
42
43
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 41
def method_missing method, args
@moneta_store.call method, *args
end
|
Instance Attribute Details
#moneta_store ⇒ Object
Returns the value of attribute moneta_store.
3
4
5
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 3
def moneta_store
@moneta_store
end
|
Instance Method Details
#[](key) ⇒ Object
9
10
11
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 9
def [] key
@moneta_store["#{@ns}:#{key}"]
end
|
#[]=(key, value) ⇒ Object
13
14
15
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 13
def []= key, value
@moneta_store["#{@ns}:#{key}"] = value
end
|
#clear ⇒ Object
37
38
39
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 37
def clear
@moneta_store.clear
end
|
#delete(key) ⇒ Object
17
18
19
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 17
def delete key
@moneta_store.delete "#{@ns}:#{key}"
end
|
#has_key?(key) ⇒ Boolean
25
26
27
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 25
def has_key? key
@moneta_store.has_key? "#{@ns}:#{key}"
end
|
#key?(key) ⇒ Boolean
21
22
23
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 21
def key? key
@moneta_store.key? "#{@ns}:#{key}"
end
|
#store(key, value, options) ⇒ Object
29
30
31
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 29
def store key, value, options
@moneta_store.store "#{@ns}:#{key}", value, options
end
|
#update_key(key, options) ⇒ Object
33
34
35
|
# File 'lib/whiplash/app/moneta/namespace.rb', line 33
def update_key key, options
@moneta_store.update_key "#{@ns}:#{key}", options
end
|