method_profiler 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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: #{@
|
80
|
+
"MethodProfiler results for: #{@name}",
|
79
81
|
Hirb::Helpers::Table.render(
|
80
82
|
to_a,
|
81
83
|
headers: HEADERS.dup,
|
data/method_profiler.gemspec
CHANGED
@@ -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
|
|
data/spec/spec_helper.rb
CHANGED
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.
|
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-
|
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:
|