Skip to content
Browse files

Remove support for Ruby 1.8.

  • Loading branch information...
1 parent c41c717 commit e8edeb1efeeb28ae480ca2441051b24b8de09099 @jimmycuadra jimmycuadra committed
Showing with 20 additions and 33 deletions.
  1. +0 −3 .travis.yml
  2. +0 −9 lib/method_profiler/core_ext/object.rb
  3. +6 −7 lib/method_profiler/profiler.rb
  4. +14 −14 lib/method_profiler/report.rb
View
3 .travis.yml
@@ -1,7 +1,4 @@
language: ruby
rvm:
- - 1.8.7
- 1.9.3
- jruby
- - rbx
- - ree
View
9 lib/method_profiler/core_ext/object.rb
@@ -1,9 +0,0 @@
-# Backports Object#singleton_class from Ruby 1.9.2
-class Object
- # Returns the singleton class of an object.
- #
- # @return [Object] The object's singleton class.
- def singleton_class
- class << self; self end
- end
-end if RUBY_VERSION < "1.9.2"
View
13 lib/method_profiler/profiler.rb
@@ -1,5 +1,4 @@
require 'method_profiler/report'
-require 'method_profiler/core_ext/object'
require 'benchmark'
@@ -89,12 +88,12 @@ def final_data
total_time = records.reduce(:+)
average = total_time / total_calls
results << {
- :method => method,
- :min => records.min,
- :max => records.max,
- :average => average,
- :total_time => total_time,
- :total_calls => total_calls,
+ method: method,
+ min: records.min,
+ max: records.max,
+ average: average,
+ total_time: total_time,
+ total_calls: total_calls,
}
end
View
28 lib/method_profiler/report.rb
@@ -7,12 +7,12 @@ module MethodProfiler
class Report
# Report headers
HEADERS = {
- :method => "Method",
- :min => "Min Time",
- :max => "Max Time",
- :average => "Average Time",
- :total_time => "Total Time",
- :total_calls => "Total Calls",
+ method: "Method",
+ min: "Min Time",
+ max: "Max Time",
+ average: "Average Time",
+ total_time: "Total Time",
+ total_calls: "Total Calls",
}
# Fields that can be passed to {#sort_by}.
@@ -78,15 +78,15 @@ def to_s
"MethodProfiler results for: #{@obj}",
Hirb::Helpers::Table.render(
to_a,
- :headers => HEADERS.dup,
- :fields => FIELDS.dup,
- :filters => {
- :min => :to_milliseconds,
- :max => :to_milliseconds,
- :average => :to_milliseconds,
- :total_time => :to_milliseconds,
+ headers: HEADERS.dup,
+ fields: FIELDS.dup,
+ filters: {
+ min: :to_milliseconds,
+ max: :to_milliseconds,
+ average: :to_milliseconds,
+ total_time: :to_milliseconds,
},
- :description => false
+ description: false
)
].join("\n")
end

0 comments on commit e8edeb1

Please sign in to comment.
Something went wrong with that request. Please try again.