lineprof 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lineprof.rb +9 -4
- data/lib/lineprof/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 068d92a8e134b51fdb78e66e6c7364a8351fa7b7
|
4
|
+
data.tar.gz: a5745996dce9e47c7b232c627054726e7ba0f89b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bc9864ac9470bab131b4f83b271f4068885b5b4649cad093af208c89b5a14dc4aacabd308378a68ff8a0821dc63dd70049a82c968b3ef178d1a72a3c34747b8
|
7
|
+
data.tar.gz: 345eb06123850fbb9f7091029e159250881000dc51034466e58c04a57db9714235d29d2d38753455b7cfa9bf7dd75c9838026aa3c8fe483aaceafd9b9fc00d33
|
data/lib/lineprof.rb
CHANGED
@@ -2,12 +2,13 @@ require 'rblineprof'
|
|
2
2
|
require 'rack/lineprof/source_extension'
|
3
3
|
|
4
4
|
class Lineprof
|
5
|
-
IGNORE_PATTERN
|
5
|
+
IGNORE_PATTERN = /lib\/lineprof\.rb$/
|
6
|
+
DEFAULT_PATTERN = /./
|
6
7
|
|
7
8
|
class << self
|
8
|
-
def profile(&block)
|
9
|
-
value
|
10
|
-
result = lineprof(
|
9
|
+
def profile(filename = caller_filename(caller), &block)
|
10
|
+
value = nil
|
11
|
+
result = lineprof(filename) { value = block.call }
|
11
12
|
|
12
13
|
puts Term::ANSIColor.blue("\n[Lineprof] #{'=' * 70}")
|
13
14
|
puts "\n#{format(result)}\n"
|
@@ -16,6 +17,10 @@ class Lineprof
|
|
16
17
|
|
17
18
|
private
|
18
19
|
|
20
|
+
def caller_filename(caller_lines)
|
21
|
+
caller_lines.first.split(':').first || DEFAULT_PATTERN
|
22
|
+
end
|
23
|
+
|
19
24
|
def format(result)
|
20
25
|
sources = result.map do |filename, samples|
|
21
26
|
next if filename =~ IGNORE_PATTERN
|
data/lib/lineprof/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lineprof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rblineprof
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.4.5
|
120
|
+
rubygems_version: 2.4.5.1
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Easy-to-use line profiler for Ruby.
|