Module: MemoryTracker::Stores::Loader
- Defined in:
- lib/memory_tracker/stores/loader.rb
Class Method Summary collapse
- .enable_all(memory_tracker) ⇒ Object
- .enable_store(memory_tracker, opts) ⇒ Object
- .register_store(name, klass) ⇒ Object
Class Method Details
.enable_all(memory_tracker) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/memory_tracker/stores/loader.rb', line 17 def self.enable_all(memory_tracker) store_classes.each do |name, klass| store = klass.new({}) memory_tracker.add_store(store) end end |
.enable_store(memory_tracker, opts) ⇒ Object
11 12 13 14 15 |
# File 'lib/memory_tracker/stores/loader.rb', line 11 def self.enable_store(memory_tracker, opts) klass = store_classes.fetch(opts[:name].to_sym) { raise "unknown store: #{opts[:name]}" } store = klass.new(opts) memory_tracker.add_store(store) end |
.register_store(name, klass) ⇒ Object
6 7 8 9 |
# File 'lib/memory_tracker/stores/loader.rb', line 6 def self.register_store(name, klass) self.store_classes ||= {} store_classes[name] = klass end |