Class: Magellan::Gcs::Proxy::ProgressNotifierAdapter
- Inherits:
-
Object
- Object
- Magellan::Gcs::Proxy::ProgressNotifierAdapter
- Defined in:
- lib/magellan/gcs/proxy/progress_notifier_adapter.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(logger) ⇒ ProgressNotifierAdapter
constructor
A new instance of ProgressNotifierAdapter.
- #ltsv(hash) ⇒ Object
- #notify(severity, job_message, data, attrs) ⇒ Object
Constructor Details
#initialize(logger) ⇒ ProgressNotifierAdapter
Returns a new instance of ProgressNotifierAdapter.
8 9 10 |
# File 'lib/magellan/gcs/proxy/progress_notifier_adapter.rb', line 8 def initialize(logger) @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/magellan/gcs/proxy/progress_notifier_adapter.rb', line 7 def logger @logger end |
Instance Method Details
#ltsv(hash) ⇒ Object
12 13 14 |
# File 'lib/magellan/gcs/proxy/progress_notifier_adapter.rb', line 12 def ltsv(hash) hash.map { |k, v| "#{k}:#{v}" }.join("\t") end |
#notify(severity, job_message, data, attrs) ⇒ Object
16 17 18 19 20 |
# File 'lib/magellan/gcs/proxy/progress_notifier_adapter.rb', line 16 def notify(severity, , data, attrs) d = { job_message_id: . }.merge(attrs) d[:data] = data # Show data at the end of string logger.send(severity, ltsv(d)) end |