statval 0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -111,6 +111,16 @@ module StatVal
111
111
  this
112
112
  end
113
113
 
114
+ def time
115
+ start = Time.now
116
+ begin
117
+ yield
118
+ ensure
119
+ stop = Time.now
120
+ self << (stop-start)
121
+ end
122
+ end
123
+
114
124
  def key_hash(which_keys = nil)
115
125
  return which_keys if which_keys.is_a?(Hash)
116
126
 
@@ -1,3 +1,3 @@
1
1
  module StatVal
2
- VERSION = '0.1'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -74,5 +74,12 @@ module StatVal
74
74
  ::StatVal.map_hash(@it).keys.to_set.should be == [ :h, :a ].to_set
75
75
  ::StatVal.flatmap_hash(@it).keys.to_set.should be == [ 'a', 'num_h', 'std_h', 'min_h', 'max_h', 'avg_h' ].to_set
76
76
  end
77
+
78
+ it 'times' do
79
+ @it = StatVal.new
80
+ @it.time {|| sleep(2) }
81
+ @it.avg.should be > 2.0
82
+ @it.avg.should be < 3.0
83
+ end
77
84
  end
78
85
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.description = 'Utility class for incrementally recording measured values and reporting avg, variance, min, and max'
10
10
  s.author = 'Stefan Plantikow'
11
11
  s.email = 'stefanp@moviepilot.com'
12
- s.homepage = 'http://moviepilot.github.com/statval'
12
+ s.homepage = 'https://github.com/moviepilot/statval'
13
13
  s.rubyforge_project = 'statval'
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statval
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -30,7 +30,7 @@ files:
30
30
  - spec/lib/statval/statval_spec.rb
31
31
  - spec/spec_helper.rb
32
32
  - statval.gemspec
33
- homepage: http://moviepilot.github.com/statval
33
+ homepage: https://github.com/moviepilot/statval
34
34
  licenses:
35
35
  - PUBLIC DOMAIN WITHOUT ANY WARRANTY
36
36
  post_install_message:
@@ -45,7 +45,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
45
45
  version: '0'
46
46
  segments:
47
47
  - 0
48
- hash: -3748375320206604171
48
+ hash: -3832811953487468408
49
49
  required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements: