quicky 0.1.0 → 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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- quicky (0.0.3)
4
+ quicky (0.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,15 @@
1
+ module Quicky
2
+
3
+ class ResultsHash < Hash
4
+
5
+ # returns results in a straight up hash.
6
+ def to_hash
7
+ ret = {}
8
+ self.each_pair do |k,v|
9
+ ret[k] = v.to_hash()
10
+ end
11
+ ret
12
+ end
13
+ end
14
+
15
+ end
@@ -1,9 +1,11 @@
1
+ require_relative 'results_hash'
2
+
1
3
  module Quicky
2
4
 
3
5
  class Timer
4
6
 
5
7
  def initialize
6
- @collector = {}
8
+ @collector = ResultsHash.new
7
9
  end
8
10
 
9
11
  def loop(name, x, options={}, &blk)
@@ -52,9 +54,10 @@ module Quicky
52
54
  end
53
55
 
54
56
  class TimeCollector
55
- INT_MAX = ( (2 ** (32 - 2)) - 1 )
57
+ INT_MAX = ((2 ** (32 - 2)) - 1)
56
58
 
57
59
  attr_accessor :name
60
+
58
61
  def initialize(name)
59
62
  @name = name
60
63
  @collector = []
@@ -91,6 +94,17 @@ module Quicky
91
94
  @collector.size
92
95
  end
93
96
 
97
+ def to_hash
98
+ {
99
+ name: self.name,
100
+ count: self.count,
101
+ duration: self.duration,
102
+ total_duration: self.total_duration,
103
+ max_duration: self.max_duration,
104
+ min_duration: self.min_duration
105
+ }
106
+ end
107
+
94
108
  end
95
109
 
96
110
  class TimeResult
@@ -1,3 +1,3 @@
1
1
  module Quicky
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -42,6 +42,9 @@ class TestBasics < TestBase
42
42
  assert result.min_duration < 0.55 && result.min_duration > 0.1
43
43
  assert result.max_duration > 0.5 && result.max_duration < 0.7
44
44
 
45
+ hash = quicky.results.to_hash
46
+ p hash
47
+ assert hash[:test3][:duration] >= 0.5
45
48
 
46
49
  end
47
50
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quicky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-09 00:00:00.000000000 Z
12
+ date: 2012-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -41,6 +41,7 @@ files:
41
41
  - README.md
42
42
  - Rakefile
43
43
  - lib/quicky.rb
44
+ - lib/quicky/results_hash.rb
44
45
  - lib/quicky/timer.rb
45
46
  - lib/quicky/version.rb
46
47
  - quicky.gemspec