Class: Vitals::Reporters::ConsoleReporter
- Inherits:
-
BaseReporter
- Object
- BaseReporter
- Vitals::Reporters::ConsoleReporter
- Defined in:
- lib/vitals/reporters/console_reporter.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
Instance Method Summary collapse
- #count(m, v) ⇒ Object
- #gauge(m, v) ⇒ Object
- #inc(m) ⇒ Object
-
#initialize(category: 'main', output: $stdout, format: nil) ⇒ ConsoleReporter
constructor
A new instance of ConsoleReporter.
- #print(str) ⇒ Object
- #timing(m, v) ⇒ Object
Methods inherited from BaseReporter
Constructor Details
#initialize(category: 'main', output: $stdout, format: nil) ⇒ ConsoleReporter
Returns a new instance of ConsoleReporter.
5 6 7 8 9 |
# File 'lib/vitals/reporters/console_reporter.rb', line 5 def initialize(category:'main', output: $stdout, format:nil) @format = format @category = category @output = output end |
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
3 4 5 |
# File 'lib/vitals/reporters/console_reporter.rb', line 3 def format @format end |
Instance Method Details
#count(m, v) ⇒ Object
19 20 21 |
# File 'lib/vitals/reporters/console_reporter.rb', line 19 def count(m, v) print "#{@category} COUNT #{self.format.format(m)} #{v}" end |
#gauge(m, v) ⇒ Object
15 16 17 |
# File 'lib/vitals/reporters/console_reporter.rb', line 15 def gauge(m, v) print "#{@category} GAUGE #{self.format.format(m)} #{v}" end |
#inc(m) ⇒ Object
11 12 13 |
# File 'lib/vitals/reporters/console_reporter.rb', line 11 def inc(m) print "#{@category} INC #{self.format.format(m)}" end |
#print(str) ⇒ Object
27 28 29 |
# File 'lib/vitals/reporters/console_reporter.rb', line 27 def print(str) @output.printf("#{ str }\n") end |
#timing(m, v) ⇒ Object
23 24 25 |
# File 'lib/vitals/reporters/console_reporter.rb', line 23 def timing(m, v) print "#{@category} TIME #{self.format.format(m)} #{v}" end |