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.
13 14 15 16 17 18 |
# File 'lib/fuey_client/fuey/client.rb', line 13 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
20 21 22 |
# File 'lib/fuey_client/fuey/client.rb', line 20 def reporter @_reporter ||= Reporters::NotificationQueue.new(Fuey::Redis.instance) end |
#run ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/fuey_client/fuey/client.rb', line 24 def run TraceRepository.new.all.each do |trace| trace.receiver = reporter output = trace.run Log.write %([#{trace.name}] #{output}) end end |
#setup_notifications(notifications) ⇒ Object
32 33 34 35 36 |
# File 'lib/fuey_client/fuey/client.rb', line 32 def setup_notifications(notifications) notifications.each do |name, subscriber| ActiveSupport::Notifications.subscribe name, ActiveSupport::Inflector.constantize(subscriber).new end end |