timeit 0.0.2 → 0.0.3

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.
data/examples/duration.rb CHANGED
@@ -5,7 +5,7 @@ Timeit.ti do |timer|
5
5
  1.upto(100) do |i|
6
6
  if i % 10 == 0
7
7
  timer.tick!(10)
8
- puts "#{i} of 1000 in #{timer.duration} #{timer.rate} items/s"
8
+ puts "#{timer.count} of 1000 in #{timer.duration} #{timer.rate} items/s"
9
9
  end
10
10
  sleep(0.1)
11
11
  # timer.split! if i % 300 == 0
data/lib/timeit.rb CHANGED
@@ -5,21 +5,21 @@ module Timeit
5
5
 
6
6
  class Timer
7
7
 
8
- attr_reader :start_time
8
+ attr_reader :start_time, :count
9
9
 
10
10
  def initialize(start = Time.now)
11
11
  @start_time = start
12
- @iterations = 0
12
+ @count = 0
13
13
  @rate = 0
14
14
 
15
15
  @split_time = start
16
- @split_iterations = 0
16
+ @split_count = 0
17
17
  @split_rate = 0
18
18
  end
19
19
 
20
20
  def duration
21
21
  duration = Time.now - @start_time
22
- @rate = @iterations / duration
22
+ @rate = @count / duration
23
23
  duration
24
24
  end
25
25
 
@@ -31,8 +31,8 @@ module Timeit
31
31
  split = Time.now - @split_time
32
32
  @split_time = Time.now
33
33
 
34
- @split_rate = @split_iterations / split
35
- @split_iterations = 0
34
+ @split_rate = @split_count / split
35
+ @split_count = 0
36
36
 
37
37
  split
38
38
  end
@@ -42,8 +42,8 @@ module Timeit
42
42
  end
43
43
 
44
44
  def tick!(count = 1)
45
- @iterations += count
46
- @split_iterations += count
45
+ @count += count
46
+ @split_count += count
47
47
  end
48
48
 
49
49
  def rate
@@ -1,3 +1,3 @@
1
1
  module Timeit
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/timeit.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency "rake"
26
26
 
27
- if !! (RUBY_PLATFORM =~ /java/)
27
+ if defined?(JRUBY_VERSION)
28
28
  # For some reason the pure ruby version isn't found by Bundler
29
29
  spec.platform = 'java'
30
30
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timeit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: