Class: Rack::Lineprof::Sample
- Inherits:
-
Struct
- Object
- Struct
- Rack::Lineprof::Sample
- Defined in:
- lib/rack/lineprof/sample.rb
Instance Attribute Summary collapse
-
#calls ⇒ Object
Returns the value of attribute calls.
-
#code ⇒ Object
Returns the value of attribute code.
-
#level ⇒ Object
Returns the value of attribute level.
-
#line ⇒ Object
Returns the value of attribute line.
-
#ms ⇒ Object
Returns the value of attribute ms.
Instance Method Summary collapse
Instance Attribute Details
#calls ⇒ Object
Returns the value of attribute calls
3 4 5 |
# File 'lib/rack/lineprof/sample.rb', line 3 def calls @calls end |
#code ⇒ Object
Returns the value of attribute code
3 4 5 |
# File 'lib/rack/lineprof/sample.rb', line 3 def code @code end |
#level ⇒ Object
Returns the value of attribute level
3 4 5 |
# File 'lib/rack/lineprof/sample.rb', line 3 def level @level end |
#line ⇒ Object
Returns the value of attribute line
3 4 5 |
# File 'lib/rack/lineprof/sample.rb', line 3 def line @line end |
#ms ⇒ Object
Returns the value of attribute ms
3 4 5 |
# File 'lib/rack/lineprof/sample.rb', line 3 def ms @ms end |
Instance Method Details
#format(colorize = true) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rack/lineprof/sample.rb', line 4 def format(colorize = true) formatted = if level == CONTEXT sprintf " | % 3i %s", line, code else sprintf "% 6.1fms %5i | % 3i %s", ms, calls, line, code end return formatted unless colorize case level when CRITICAL color.red formatted when WARNING color.yellow formatted when NOMINAL color.white formatted else # CONTEXT color.intense_black formatted end end |