Class: LogTool::Block
- Inherits:
-
Object
- Object
- LogTool::Block
- Defined in:
- lib/logtool/block.rb
Instance Attribute Summary collapse
-
#asset ⇒ Object
Returns the value of attribute asset.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#method ⇒ Object
Returns the value of attribute method.
-
#response ⇒ Object
Returns the value of attribute response.
-
#text ⇒ Object
Returns the value of attribute text.
-
#time ⇒ Object
Returns the value of attribute time.
Class Method Summary collapse
- .asset_tail ⇒ Object
- .head ⇒ Object
-
.head_2_3 ⇒ Object
old rails head.
- .tail ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#asset ⇒ Object
Returns the value of attribute asset.
3 4 5 |
# File 'lib/logtool/block.rb', line 3 def asset @asset end |
#ip ⇒ Object
Returns the value of attribute ip.
3 4 5 |
# File 'lib/logtool/block.rb', line 3 def ip @ip end |
#method ⇒ Object
Returns the value of attribute method.
3 4 5 |
# File 'lib/logtool/block.rb', line 3 def method @method end |
#response ⇒ Object
Returns the value of attribute response.
3 4 5 |
# File 'lib/logtool/block.rb', line 3 def response @response end |
#text ⇒ Object
Returns the value of attribute text.
3 4 5 |
# File 'lib/logtool/block.rb', line 3 def text @text end |
#time ⇒ Object
Returns the value of attribute time.
3 4 5 |
# File 'lib/logtool/block.rb', line 3 def time @time end |
Class Method Details
.asset_tail ⇒ Object
37 38 39 40 41 |
# File 'lib/logtool/block.rb', line 37 def self.asset_tail # $1 = response, $2 = time time = /\d+(ms|s)/ /^Served asset [0-9a-zA-Z\/._]+ - (\d\d\d) .*? \((\d+ms)\)$/ end |
.head ⇒ Object
21 22 23 24 |
# File 'lib/logtool/block.rb', line 21 def self.head #$1 = method, $2 = IP /^Started (GET|POST|PUT|DELETE) ".+?" for (\d\d?\d?.\d\d?\d?.\d\d?\d?.\d\d?\d?) at .*$/ end |
.head_2_3 ⇒ Object
old rails head
26 27 28 29 |
# File 'lib/logtool/block.rb', line 26 def self.head_2_3 # old rails head #$1 = IP, $2 = method /^Processing .+? \(for (\d\d?\d?.\d\d?\d?.\d\d?\d?.\d\d?\d?) at .*?(GET|POST|PUT|DELETE).*$/ end |
.tail ⇒ Object
31 32 33 34 35 |
# File 'lib/logtool/block.rb', line 31 def self.tail # $1 = response time = /\d+(ms|s)/ /^Completed (\d\d\d) .+? in (\d+ms)$/ end |
Instance Method Details
#head ⇒ Object
13 14 15 |
# File 'lib/logtool/block.rb', line 13 def head @text.split("\n").first end |
#is_asset? ⇒ Boolean
9 10 11 |
# File 'lib/logtool/block.rb', line 9 def is_asset? @asset end |
#tail ⇒ Object
17 18 19 |
# File 'lib/logtool/block.rb', line 17 def tail @text.split("\n").last end |
#test_for(query) ⇒ Object
43 44 45 46 47 |
# File 'lib/logtool/block.rb', line 43 def test_for(query) eval query rescue => e LogTool::fatal_error("Bad filter. #{e.}") end |
#to_s ⇒ Object
5 6 7 |
# File 'lib/logtool/block.rb', line 5 def to_s @text end |