This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Make compatible with ruby 1.8.6, 1.8.7, and ree

  • Loading branch information...
halogenandtoast committed May 6, 2011
1 parent 11bcec4 commit b17d730ab3fe12877a2b324a736160888ab1f592
Showing with 9 additions and 5 deletions.
  1. +1 −0 Gemfile
  2. +2 −0 Gemfile.lock
  3. +3 −2 lib/daikon/monitor.rb
  4. +1 −1 spec/client_spec.rb
  5. +2 −2 spec/reactor_spec.rb
View
@@ -13,4 +13,5 @@ group :development do
gem "rspec"
gem "timecop"
gem "webmock"
+ gem "SystemTimer", :platform => :mri_18
end
View
@@ -7,6 +7,7 @@ GIT
GEM
remote: http://rubygems.org/
specs:
+ SystemTimer (1.2)
addressable (2.2.5)
bourne (1.0)
mocha (= 0.9.8)
@@ -49,6 +50,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ SystemTimer
bourne
daemons (= 1.1.0)
em-hiredis (= 0.1.0)
View
@@ -19,12 +19,13 @@ def self.reset
end
def self.pop
- time, summary = self.summaries.first
+ time = self.summaries.keys.sort.first
+ summary = self.summaries[time]
if summary.nil?
summary = summary_hash
end
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)
summaries.delete(time) if time
end
View
@@ -73,7 +73,7 @@
end
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
View
@@ -17,7 +17,7 @@
times = []
subject.on(:start_info) do
times << Time.now
- if times.count == 2
+ if times.length == 2
EM.stop
(times[1] - times[0]).should be_within(0.1).of(subject.info_interval)
end
@@ -32,7 +32,7 @@
times = []
subject.on(:start_summary) do
times << Time.now
- if times.count == 2
+ if times.length == 2
EM.stop
(times[1] - times[0]).should be_within(0.1).of(subject.summary_interval)
end

0 comments on commit b17d730

Please sign in to comment.