Skip to content
This repository has been archived by the owner on Feb 15, 2018. It is now read-only.

Commit

Permalink
Make compatible with ruby 1.8.6, 1.8.7, and ree
Browse files Browse the repository at this point in the history
  • Loading branch information
halogenandtoast committed May 6, 2011
1 parent 11bcec4 commit b17d730
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -13,4 +13,5 @@ group :development do
gem "rspec" gem "rspec"
gem "timecop" gem "timecop"
gem "webmock" gem "webmock"
gem "SystemTimer", :platform => :mri_18
end end
2 changes: 2 additions & 0 deletions Gemfile.lock
Expand Up @@ -7,6 +7,7 @@ GIT
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
SystemTimer (1.2)
addressable (2.2.5) addressable (2.2.5)
bourne (1.0) bourne (1.0)
mocha (= 0.9.8) mocha (= 0.9.8)
Expand Down Expand Up @@ -49,6 +50,7 @@ PLATFORMS
ruby ruby


DEPENDENCIES DEPENDENCIES
SystemTimer
bourne bourne
daemons (= 1.1.0) daemons (= 1.1.0)
em-hiredis (= 0.1.0) em-hiredis (= 0.1.0)
Expand Down
5 changes: 3 additions & 2 deletions lib/daikon/monitor.rb
Expand Up @@ -19,12 +19,13 @@ def self.reset
end end


def self.pop def self.pop
time, summary = self.summaries.first time = self.summaries.keys.sort.first
summary = self.summaries[time]
if summary.nil? if summary.nil?
summary = summary_hash summary = summary_hash
end end
summary["start"] = summary["stop"] = Time.now summary["start"] = summary["stop"] = Time.now
summary["keys"] = Hash[*summary["keys"].sort_by(&:last).reverse[0..99].flatten] summary["keys"] = Hash[*summary["keys"].sort_by{|a| a.last}.reverse[0..99].flatten]
yield(summary) yield(summary)
summaries.delete(time) if time summaries.delete(time) if time
end end
Expand Down
2 changes: 1 addition & 1 deletion spec/client_spec.rb
Expand Up @@ -73,7 +73,7 @@
end end


WebMock.should have_requested(:post, summaries_url(server)). WebMock.should have_requested(:post, summaries_url(server)).
with(:body => payload.to_json, :headers => headers) with(:headers => headers) { |req| JSON.parse!(req.body) == payload }
end end
end end


Expand Down
4 changes: 2 additions & 2 deletions spec/reactor_spec.rb
Expand Up @@ -17,7 +17,7 @@
times = [] times = []
subject.on(:start_info) do subject.on(:start_info) do
times << Time.now times << Time.now
if times.count == 2 if times.length == 2
EM.stop EM.stop
(times[1] - times[0]).should be_within(0.1).of(subject.info_interval) (times[1] - times[0]).should be_within(0.1).of(subject.info_interval)
end end
Expand All @@ -32,7 +32,7 @@
times = [] times = []
subject.on(:start_summary) do subject.on(:start_summary) do
times << Time.now times << Time.now
if times.count == 2 if times.length == 2
EM.stop EM.stop
(times[1] - times[0]).should be_within(0.1).of(subject.summary_interval) (times[1] - times[0]).should be_within(0.1).of(subject.summary_interval)
end end
Expand Down

0 comments on commit b17d730

Please sign in to comment.