Class: Fuey::Client
- Inherits:
-
Object
- Object
- Fuey::Client
- Defined in:
- lib/fuey_client/fuey/client.rb
Instance Method Summary collapse
-
#initialize(path_to_config_dir = "", notifications = nil) ⇒ Client
constructor
A new instance of Client.
- #reporter ⇒ Object
- #run ⇒ Object
- #setup_notifications(notifications) ⇒ Object
Constructor Details
#initialize(path_to_config_dir = "", notifications = nil) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 |
# File 'lib/fuey_client/fuey/client.rb', line 12 def initialize(path_to_config_dir="", notifications=nil) Configurethis.root_path = path_to_config_dir notifications = Config::Fuey.notifications if notifications.nil? setup_notifications notifications end |
Instance Method Details
#reporter ⇒ Object
19 20 21 |
# File 'lib/fuey_client/fuey/client.rb', line 19 def reporter @_reporter ||= Reporters::Redis.new end |
#run ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/fuey_client/fuey/client.rb', line 23 def run Trace.all.each do |trace| trace.add_observer reporter output = trace.run Log.write %([#{trace.name}] #{output}) end end |
#setup_notifications(notifications) ⇒ Object
31 32 33 34 35 |
# File 'lib/fuey_client/fuey/client.rb', line 31 def setup_notifications(notifications) notifications.each do |name, subscriber| ActiveSupport::Notifications.subscribe name, ActiveSupport::Inflector.constantize(subscriber).new end end |