method_profiler 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,7 @@ module MethodProfiler
25
25
  # @return [Report] A new report with all the data the profiler has collected.
26
26
  #
27
27
  def report
28
- Report.new(final_data)
28
+ Report.new(final_data, @obj.name)
29
29
  end
30
30
 
31
31
  private
@@ -24,9 +24,11 @@ module MethodProfiler
24
24
  # Initializes a new {Report}. Used to sort and display data collected by a {Profiler}.
25
25
  #
26
26
  # @param [Array] data Data collected by a {Profiler}.
27
+ # @param [String] name The name of the object that was profiled.
27
28
  #
28
- def initialize(data)
29
+ def initialize(data, name)
29
30
  @data = data
31
+ @name = name
30
32
  @sort_by = :average
31
33
  @order = :descending
32
34
  end
@@ -75,7 +77,7 @@ module MethodProfiler
75
77
  #
76
78
  def to_s
77
79
  [
78
- "MethodProfiler results for: #{@obj}",
80
+ "MethodProfiler results for: #{@name}",
79
81
  Hirb::Helpers::Table.render(
80
82
  to_a,
81
83
  headers: HEADERS.dup,
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "method_profiler"
5
- s.version = "2.0.0"
5
+ s.version = "2.0.1"
6
6
  s.authors = ["Jimmy Cuadra"]
7
7
  s.email = ["jimmy@jimmycuadra.com"]
8
8
  s.homepage = "https://github.com/change/method_profiler"
@@ -71,6 +71,10 @@ describe MethodProfiler::Report do
71
71
  end
72
72
 
73
73
  describe "#to_s" do
74
+ it "displays the name of the profiled object" do
75
+ @report.to_s.should include("MethodProfiler results for: Petition")
76
+ end
77
+
74
78
  it "outputs one line for each method that was called" do
75
79
  output = @report.to_s
76
80
 
@@ -1,4 +1,5 @@
1
1
  require "simplecov"
2
+ SimpleCov.add_filter "spec"
2
3
  SimpleCov.start
3
4
 
4
5
  $:.unshift(File.expand_path("../../lib", __FILE__))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: method_profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-09 00:00:00.000000000 Z
12
+ date: 2013-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hirb
@@ -96,12 +96,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
96
  - - ! '>='
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
+ segments:
100
+ - 0
101
+ hash: 3503720306492562241
99
102
  required_rubygems_version: !ruby/object:Gem::Requirement
100
103
  none: false
101
104
  requirements:
102
105
  - - ! '>='
103
106
  - !ruby/object:Gem::Version
104
107
  version: '0'
108
+ segments:
109
+ - 0
110
+ hash: 3503720306492562241
105
111
  requirements: []
106
112
  rubyforge_project:
107
113
  rubygems_version: 1.8.23
@@ -114,4 +120,3 @@ test_files:
114
120
  - spec/method_profiler_spec.rb
115
121
  - spec/spec_helper.rb
116
122
  - spec/support/petition.rb
117
- has_rdoc: