Class: RShade::Config::Registry
- Includes:
- Singleton
- Defined in:
- lib/rshade/config/registry.rb
Constant Summary collapse
- DEFAULT_EVENT_STORE =
:event_store_default- DEFAULT_STACK_STORE =
:stack_store_default
Instance Attribute Summary collapse
-
#map ⇒ Object
readonly
Returns the value of attribute map.
-
#mutex ⇒ Object
readonly
Returns the value of attribute mutex.
Instance Method Summary collapse
- #default_stack_config ⇒ Object
- #default_trace_config ⇒ Object
- #defaults ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #stack_config(&block) ⇒ Object
- #trace_config(&block) ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
12 13 14 15 16 |
# File 'lib/rshade/config/registry.rb', line 12 def initialize @map = {} @mutex = Mutex.new defaults end |
Instance Attribute Details
#map ⇒ Object (readonly)
Returns the value of attribute map.
7 8 9 |
# File 'lib/rshade/config/registry.rb', line 7 def map @map end |
#mutex ⇒ Object (readonly)
Returns the value of attribute mutex.
7 8 9 |
# File 'lib/rshade/config/registry.rb', line 7 def mutex @mutex end |
Instance Method Details
#default_stack_config ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/rshade/config/registry.rb', line 18 def default_stack_config val = nil mutex.synchronize do val = map[DEFAULT_STACK_STORE] end val end |
#default_trace_config ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/rshade/config/registry.rb', line 36 def default_trace_config val = nil mutex.synchronize do val = map[DEFAULT_EVENT_STORE] end val end |
#defaults ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/rshade/config/registry.rb', line 54 def defaults mutex.synchronize do stack_store = ::RShade::Config::StackStore.new stack_store.exclude_gems! map[DEFAULT_STACK_STORE] = stack_store event_store = ::RShade::Config::EventStore.new event_store.exclude_gems! map[DEFAULT_EVENT_STORE] = event_store end end |
#stack_config(&block) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/rshade/config/registry.rb', line 26 def stack_config(&block) val = nil mutex.synchronize do val = ::RShade::Config::StackStore.new block.call(val) map[DEFAULT_STACK_STORE] = val end val end |
#trace_config(&block) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/rshade/config/registry.rb', line 44 def trace_config(&block) val = nil mutex.synchronize do val = ::RShade::Config::EventStore.new block.call(val) map[DEFAULT_EVENT_STORE] = val end val end |