rubyperf 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -63,6 +63,14 @@ module Perf
63
63
  end
64
64
  end
65
65
 
66
+ # meter is like get, but if the meter doesn't already exists it returns a NoOpMeter. You can use this every time
67
+ # that you want "somebody else" make the decision of what meter to use.
68
+
69
+ def self.meter(key=DEFAULT_METER)
70
+ @@perf_meters ||= {}
71
+ @@perf_meters[key] ||= Perf::NoOpMeter.new
72
+ end
73
+
66
74
  # To set options for new meters created by get, when specific options are not passed, you can do so with this
67
75
  # method.
68
76
 
data/rubyperf.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rubyperf}
8
- s.version = "1.1.0"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["lpasqualis"]
12
- s.date = %q{2012-01-15}
12
+ s.date = %q{2012-01-16}
13
13
  s.description = %q{Used to easily measure the performance of blocks of Ruby code, expressions and methods; provides reporting in various formats}
14
14
  s.email = %q{lpasqualis@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -33,6 +33,16 @@ class TestMeterFactory < Test::Unit::TestCase
33
33
  assert m1.report_simple.nil?
34
34
  end
35
35
 
36
+ def test_meter
37
+ m=Perf::MeterFactory.meter
38
+ assert m.is_a? Perf::NoOpMeter
39
+
40
+ Perf::MeterFactory.clear_all!
41
+ m=Perf::MeterFactory.get
42
+ m=Perf::MeterFactory.meter
43
+ assert m.is_a? Perf::Meter
44
+ end
45
+
36
46
  def test_noop2
37
47
  Perf::MeterFactory.set_factory_options(:noop=>true)
38
48
  m=Perf::MeterFactory.get()
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyperf
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - lpasqualis
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-15 00:00:00 -08:00
18
+ date: 2012-01-16 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency