Class: SolidObserver::Queries::EventsQuery
- Inherits:
-
Object
- Object
- SolidObserver::Queries::EventsQuery
- Defined in:
- lib/solid_observer/queries/events_query.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(filter) ⇒ EventsQuery
constructor
A new instance of EventsQuery.
Constructor Details
#initialize(filter) ⇒ EventsQuery
Returns a new instance of EventsQuery.
6 7 8 |
# File 'lib/solid_observer/queries/events_query.rb', line 6 def initialize(filter) @filter = filter end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/solid_observer/queries/events_query.rb', line 10 def call event_type = @filter.event_type job_class = @filter.job_class queue_name = @filter.queue_name from = @filter.from to = @filter.to scope = QueueEvent.order(recorded_at: :desc) scope = scope.by_event_type(event_type) if event_type.present? scope = scope.by_job_class(job_class) if job_class.present? scope = scope.by_queue(queue_name) if queue_name.present? scope = scope.since(from.beginning_of_day) if from scope = scope.before(to.end_of_day) if to scope end |