memory_tracker 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ module MemoryTracker
2
+ module Stores
3
+ class Base
4
+ class_attribute :name
5
+
6
+ def self.register_store(name)
7
+ self.name = name
8
+ Loader.register_store(name, self)
9
+ end
10
+
11
+ def name
12
+ self.class.name
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,29 @@
1
+ module MemoryTracker
2
+ module Stores
3
+ module Loader
4
+ mattr_accessor :store_classes
5
+
6
+ def self.register_store(name, klass)
7
+ self.store_classes ||= {}
8
+ store_classes[name] = klass
9
+ end
10
+
11
+ def self.enable_store(memory_tracker, opts)
12
+ klass = store_classes.fetch(opts[:name].to_sym) { raise "unknown store: #{opts[:name]}" }
13
+ store = klass.new(opts)
14
+ memory_tracker.add_store(store)
15
+ end
16
+
17
+ def self.enable_all(memory_tracker)
18
+ store_classes.each do |name, klass|
19
+ store = klass.new({})
20
+ memory_tracker.add_store(store)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ store_filenames = Dir["#{File.expand_path('..', __FILE__)}/*_store.rb"]
28
+ store_filenames.each { |f| require f }
29
+
@@ -1,3 +1,3 @@
1
1
  module MemoryTracker
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -41,6 +41,8 @@ Gem::Specification.new do |s|
41
41
  "lib/memory_tracker/stores/gcstat_logfile_store.rb",
42
42
  "lib/memory_tracker/stores/in_memory_store.rb",
43
43
  "lib/memory_tracker/stores/url_logfile_store.rb",
44
+ "lib/memory_tracker/stores/loader.rb",
45
+ "lib/memory_tracker/stores/base.rb",
44
46
  "memory_tracker.gemspec"]
45
47
  s.test_files = Dir["spec/**/*"]
46
48
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memory_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -138,6 +138,8 @@ files:
138
138
  - lib/memory_tracker/stores/gcstat_logfile_store.rb
139
139
  - lib/memory_tracker/stores/in_memory_store.rb
140
140
  - lib/memory_tracker/stores/url_logfile_store.rb
141
+ - lib/memory_tracker/stores/loader.rb
142
+ - lib/memory_tracker/stores/base.rb
141
143
  - memory_tracker.gemspec
142
144
  - spec/spec_helper.rb
143
145
  - spec/lib/stores/gcstat_logfile_store_spec.rb