Class: Onering::Reporter::PluginDelegate
- Inherits:
-
Object
- Object
- Onering::Reporter::PluginDelegate
- Defined in:
- lib/onering/plugins/reporter.rb
Instance Method Summary collapse
- #get_binding ⇒ Object
-
#initialize(reporter, options = {}) ⇒ PluginDelegate
constructor
A new instance of PluginDelegate.
- #property(name, value = nil) ⇒ Object
-
#report(&block) ⇒ Object
DSL methods ————————————————————————-.
- #stat(name, value = nil) ⇒ Object
Constructor Details
#initialize(reporter, options = {}) ⇒ PluginDelegate
Returns a new instance of PluginDelegate.
30 31 32 33 34 35 36 |
# File 'lib/onering/plugins/reporter.rb', line 30 def initialize(reporter, ={}) @_name = .get(:plugin) @_path = .get(:path) Onering::Logger.debug3("Creating plugin delegate for plugin #{@_name}", "Onering::Reporter::PluginDelegate") @_reporter = reporter end |
Instance Method Details
#get_binding ⇒ Object
38 39 40 |
# File 'lib/onering/plugins/reporter.rb', line 38 def get_binding() return binding() end |
#property(name, value = nil) ⇒ Object
55 56 57 |
# File 'lib/onering/plugins/reporter.rb', line 55 def property(name, value=nil) @_reporter.property(name, value) end |
#report(&block) ⇒ Object
DSL methods
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/onering/plugins/reporter.rb', line 44 def report(&block) if block_given? start = Time.now.to_f yield finish = (Time.now.to_f - start.to_f) finish = (finish.round(4) rescue finish) Onering::Logger.debug3("Finished evaluating report for plugin #{@_name}, took #{finish} seconds", "Onering::Reporter::PluginDelegate") end end |
#stat(name, value = nil) ⇒ Object
59 60 61 62 63 |
# File 'lib/onering/plugins/reporter.rb', line 59 def stat(name, value=nil) unless value.nil? @_reporter.property((['metrics']+name.to_s.split('.')).join('.'), value) end end |