Class: RailsConsolePro::QueueInsightsResult
- Inherits:
-
Object
- Object
- RailsConsolePro::QueueInsightsResult
- Defined in:
- lib/rails_console_pro/queue_insights_result.rb
Defined Under Namespace
Classes: ExecutionSummary, JobSummary
Instance Attribute Summary collapse
-
#adapter_name ⇒ Object
readonly
Returns the value of attribute adapter_name.
-
#adapter_type ⇒ Object
readonly
Returns the value of attribute adapter_type.
-
#captured_at ⇒ Object
readonly
Returns the value of attribute captured_at.
-
#enqueued_jobs ⇒ Object
readonly
Returns the value of attribute enqueued_jobs.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#recent_executions ⇒ Object
readonly
Returns the value of attribute recent_executions.
-
#retry_jobs ⇒ Object
readonly
Returns the value of attribute retry_jobs.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
- #adapter_label ⇒ Object
- #empty? ⇒ Boolean
- #has_enqueued? ⇒ Boolean
- #has_recent_executions? ⇒ Boolean
- #has_retry_jobs? ⇒ Boolean
-
#initialize(adapter_name:, adapter_type:, enqueued_jobs:, retry_jobs:, recent_executions:, meta: {}, warnings: [], captured_at: Time.current) ⇒ QueueInsightsResult
constructor
A new instance of QueueInsightsResult.
- #total_enqueued ⇒ Object
- #total_recent ⇒ Object
- #total_retry ⇒ Object
- #totals ⇒ Object
- #warnings? ⇒ Boolean
- #with_overrides(overrides = {}) ⇒ Object
Constructor Details
#initialize(adapter_name:, adapter_type:, enqueued_jobs:, retry_jobs:, recent_executions:, meta: {}, warnings: [], captured_at: Time.current) ⇒ QueueInsightsResult
Returns a new instance of QueueInsightsResult.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 39 def initialize(adapter_name:, adapter_type:, enqueued_jobs:, retry_jobs:, recent_executions:, meta: {}, warnings: [], captured_at: Time.current) @adapter_name = adapter_name @adapter_type = adapter_type @enqueued_jobs = Array(enqueued_jobs) @retry_jobs = Array(retry_jobs) @recent_executions = Array(recent_executions) = || {} @warnings = Array(warnings).compact @captured_at = captured_at || Time.current end |
Instance Attribute Details
#adapter_name ⇒ Object (readonly)
Returns the value of attribute adapter_name.
30 31 32 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 30 def adapter_name @adapter_name end |
#adapter_type ⇒ Object (readonly)
Returns the value of attribute adapter_type.
30 31 32 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 30 def adapter_type @adapter_type end |
#captured_at ⇒ Object (readonly)
Returns the value of attribute captured_at.
30 31 32 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 30 def captured_at @captured_at end |
#enqueued_jobs ⇒ Object (readonly)
Returns the value of attribute enqueued_jobs.
30 31 32 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 30 def enqueued_jobs @enqueued_jobs end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
30 31 32 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 30 def end |
#recent_executions ⇒ Object (readonly)
Returns the value of attribute recent_executions.
30 31 32 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 30 def recent_executions @recent_executions end |
#retry_jobs ⇒ Object (readonly)
Returns the value of attribute retry_jobs.
30 31 32 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 30 def retry_jobs @retry_jobs end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
30 31 32 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 30 def warnings @warnings end |
Instance Method Details
#adapter_label ⇒ Object
50 51 52 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 50 def adapter_label [adapter_name, adapter_type].compact.uniq.join(" ") end |
#empty? ⇒ Boolean
66 67 68 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 66 def empty? !has_enqueued? && !has_retry_jobs? && !has_recent_executions? end |
#has_enqueued? ⇒ Boolean
54 55 56 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 54 def has_enqueued? enqueued_jobs.any? end |
#has_recent_executions? ⇒ Boolean
62 63 64 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 62 def has_recent_executions? recent_executions.any? end |
#has_retry_jobs? ⇒ Boolean
58 59 60 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 58 def has_retry_jobs? retry_jobs.any? end |
#total_enqueued ⇒ Object
74 75 76 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 74 def total_enqueued enqueued_jobs.size end |
#total_recent ⇒ Object
82 83 84 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 82 def total_recent recent_executions.size end |
#total_retry ⇒ Object
78 79 80 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 78 def total_retry retry_jobs.size end |
#totals ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 86 def totals { enqueued: total_enqueued, retry: total_retry, recent: total_recent } end |
#warnings? ⇒ Boolean
70 71 72 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 70 def warnings? warnings.any? end |
#with_overrides(overrides = {}) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/rails_console_pro/queue_insights_result.rb', line 94 def with_overrides(overrides = {}) self.class.new( adapter_name: overrides.fetch(:adapter_name, adapter_name), adapter_type: overrides.fetch(:adapter_type, adapter_type), enqueued_jobs: overrides.fetch(:enqueued_jobs, enqueued_jobs), retry_jobs: overrides.fetch(:retry_jobs, retry_jobs), recent_executions: overrides.fetch(:recent_executions, recent_executions), meta: overrides.fetch(:meta, ), warnings: overrides.fetch(:warnings, warnings), captured_at: overrides.fetch(:captured_at, captured_at) ) end |