Class: PcQueues::QueueRules::BooleanQueueRule
- Inherits:
-
PcQueues::QueueRule
- Object
- ActiveRecord::Base
- PcQueues::QueueRule
- PcQueues::QueueRules::BooleanQueueRule
- Defined in:
- lib/pc_queues/queue_rules/boolean_queue_rule.rb
Overview
A BooleanQueueRule is a QueueRule that returns true when the value matches the bool_value attribute
Class Method Summary collapse
Instance Method Summary collapse
- #passes?(obj, *args) ⇒ Boolean
-
#value(obj, *args) ⇒ Object
Implementors must provide an implementation of this method that takes the args splat passed to the queue and returns a numberic value.
Methods inherited from PcQueues::QueueRule
Class Method Details
.options(opts = {}) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/pc_queues/queue_rules/boolean_queue_rule.rb', line 15 def self.(opts = {}) opts[:bool_value] ||= opts[:value] opts[:bool_value] = true if opts[:bool_value].nil? opts.except! :value super end |
Instance Method Details
#passes?(obj, *args) ⇒ Boolean
28 29 30 |
# File 'lib/pc_queues/queue_rules/boolean_queue_rule.rb', line 28 def passes?(obj, *args) value(obj, *args) == bool_value end |
#value(obj, *args) ⇒ Object
Implementors must provide an implementation of this method that takes the args splat passed to the queue and returns a numberic value
24 25 26 |
# File 'lib/pc_queues/queue_rules/boolean_queue_rule.rb', line 24 def value(obj, *args) raise NotImplementedError, "The class: #{self.class.name} requires an implementation of #{__method__}" end |