Class: Yaoc::Helper::Scope
- Inherits:
-
Object
- Object
- Yaoc::Helper::Scope
- Defined in:
- lib/yaoc/helper/scope.rb
Instance Attribute Summary collapse
-
#scope_name ⇒ Object
Returns the value of attribute scope_name.
-
#storage_source ⇒ Object
Returns the value of attribute storage_source.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #clear! ⇒ Object
- #fetch(*args, &block) ⇒ Object
-
#initialize(scope_name = "default", storage_source = ThreadGlobalStorage) ⇒ Scope
constructor
A new instance of Scope.
- #storage ⇒ Object
Constructor Details
#initialize(scope_name = "default", storage_source = ThreadGlobalStorage) ⇒ Scope
7 8 9 10 |
# File 'lib/yaoc/helper/scope.rb', line 7 def initialize(scope_name="default", storage_source=ThreadGlobalStorage) self.scope_name = scope_name self.storage_source = storage_source end |
Instance Attribute Details
#scope_name ⇒ Object
Returns the value of attribute scope_name.
5 6 7 |
# File 'lib/yaoc/helper/scope.rb', line 5 def scope_name @scope_name end |
#storage_source ⇒ Object
Returns the value of attribute storage_source.
5 6 7 |
# File 'lib/yaoc/helper/scope.rb', line 5 def storage_source @storage_source end |
Instance Method Details
#[](key) ⇒ Object
20 21 22 |
# File 'lib/yaoc/helper/scope.rb', line 20 def [](key) self.storage[key] end |
#[]=(key, value) ⇒ Object
16 17 18 |
# File 'lib/yaoc/helper/scope.rb', line 16 def []=(key, value) self.storage[key]=value end |
#clear! ⇒ Object
24 25 26 |
# File 'lib/yaoc/helper/scope.rb', line 24 def clear! self.storage.clear end |
#fetch(*args, &block) ⇒ Object
28 29 30 |
# File 'lib/yaoc/helper/scope.rb', line 28 def fetch(*args, &block) self.storage.fetch(*args, &block) end |
#storage ⇒ Object
12 13 14 |
# File 'lib/yaoc/helper/scope.rb', line 12 def storage storage_source.for(scope_name) end |