Skip to content

Commit

Permalink
Removing dependency on quantity as it conflicts with ActiveSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
johnewart committed May 11, 2011
1 parent 1a0c9d3 commit c09b117
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
BUNDLE_DISABLE_SHARED_GEMS: "1"
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ PATH
specs:
ruby-metrics (0.8.0)
json
quantity

GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.2)
json (1.5.1)
quantity (0.1.1)
rack (1.2.2)
rack-test (0.5.7)
rack (>= 1.0)
Expand Down
6 changes: 0 additions & 6 deletions lib/ruby-metrics.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# == Metrics Initialization
#
require 'quantity/all'

module Metrics

Expand All @@ -13,10 +12,5 @@ def logger

end

Quantity::Unit.add_unit :minute, :time, 60000, :minutes
Quantity::Unit.add_unit :hour, :time, 3600000, :hours
Quantity::Unit.add_unit :day, :time, 86400000, :days
Quantity::Unit.add_unit :week, :time, 604800000, :weeks


require File.join(File.dirname(__FILE__), 'ruby-metrics', 'agent')
4 changes: 2 additions & 2 deletions lib/ruby-metrics/statistics/exponential_sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def initialize(size = 1028, alpha = 0.015)
@count = 0
@size = size
@alpha = alpha
@rescale_window = 1.hour.to_seconds.to_i
@rescale_window = 3600 #seconds -- 1 hour
self.clear
end

Expand Down Expand Up @@ -89,4 +89,4 @@ def values
end
end
end
end
end
1 change: 0 additions & 1 deletion ruby-metrics.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Gem::Specification.new do |s|
s.rubyforge_project = "ruby-metrics"

s.add_dependency "json"
s.add_dependency "quantity"

s.add_development_dependency "rspec"
s.add_development_dependency "simplecov", [">= 0.3.8"] #, :require => false
Expand Down
10 changes: 5 additions & 5 deletions spec/instruments/meter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
@meter.tick()
end

def tick_for(time)
count = ((time.to_seconds) / 5).to_i
def tick_for(seconds)
count = ((seconds) / 5).to_i
(1..count).each do
@meter.tick()
end
Expand All @@ -45,7 +45,7 @@ def tick_for(time)
end

it "should have a rate of 0.22072766470286553 events/sec after 1 minute" do
tick_for(1.minute)
tick_for(60)
@meter.one_minute_rate.should == 0.22072766470286553
end
end
Expand All @@ -56,7 +56,7 @@ def tick_for(time)
end

it "should have a rate of 0.49123845184678905 events/sec after 1 minute" do
tick_for(1.minute)
tick_for(60)
@meter.five_minute_rate.should == 0.49123845184678905
end
end
Expand All @@ -75,7 +75,7 @@ def tick_for(time)
end

it "should have a rate of 0.5613041910189706 events/sec after 1 minute" do
tick_for(1.minute)
tick_for(60)
@meter.fifteen_minute_rate.should == 0.5613041910189706
end
end
Expand Down

0 comments on commit c09b117

Please sign in to comment.