Class: Sbmt::Outbox::V2::Tasks::Base
- Inherits:
-
Object
- Object
- Sbmt::Outbox::V2::Tasks::Base
- Defined in:
- lib/sbmt/outbox/v2/tasks/base.rb
Instance Attribute Summary collapse
-
#item_class ⇒ Object
readonly
Returns the value of attribute item_class.
-
#log_tags ⇒ Object
readonly
Returns the value of attribute log_tags.
-
#worker_name ⇒ Object
readonly
Returns the value of attribute worker_name.
-
#worker_version ⇒ Object
readonly
Returns the value of attribute worker_version.
-
#yabeda_labels ⇒ Object
readonly
Returns the value of attribute yabeda_labels.
Instance Method Summary collapse
-
#initialize(item_class:, worker_name:, worker_version: 2) ⇒ Base
constructor
A new instance of Base.
- #to_h ⇒ Object
Constructor Details
#initialize(item_class:, worker_name:, worker_version: 2) ⇒ Base
Returns a new instance of Base.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sbmt/outbox/v2/tasks/base.rb', line 14 def initialize(item_class:, worker_name:, worker_version: 2) @item_class = item_class @worker_name = worker_name @worker_version = worker_version @log_tags = { box_type: item_class.box_type, box_name: item_class.box_name, worker_name: worker_name, worker_version: worker_version } @yabeda_labels = { type: item_class.box_type, name: Sbmt::Outbox::Metrics::Utils.metric_safe(item_class.box_name), owner: owner, worker_version: 2, worker_name: worker_name } end |
Instance Attribute Details
#item_class ⇒ Object (readonly)
Returns the value of attribute item_class.
10 11 12 |
# File 'lib/sbmt/outbox/v2/tasks/base.rb', line 10 def item_class @item_class end |
#log_tags ⇒ Object (readonly)
Returns the value of attribute log_tags.
10 11 12 |
# File 'lib/sbmt/outbox/v2/tasks/base.rb', line 10 def @log_tags end |
#worker_name ⇒ Object (readonly)
Returns the value of attribute worker_name.
10 11 12 |
# File 'lib/sbmt/outbox/v2/tasks/base.rb', line 10 def worker_name @worker_name end |
#worker_version ⇒ Object (readonly)
Returns the value of attribute worker_version.
10 11 12 |
# File 'lib/sbmt/outbox/v2/tasks/base.rb', line 10 def worker_version @worker_version end |
#yabeda_labels ⇒ Object (readonly)
Returns the value of attribute yabeda_labels.
10 11 12 |
# File 'lib/sbmt/outbox/v2/tasks/base.rb', line 10 def yabeda_labels @yabeda_labels end |
Instance Method Details
#to_h ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/sbmt/outbox/v2/tasks/base.rb', line 35 def to_h result = {} instance_variables.each do |iv| iv = iv.to_s[1..] result[iv.to_sym] = instance_variable_get(:"@#{iv}") end result end |