Class: StripeMock::ErrorQueue
- Inherits:
-
Object
- Object
- StripeMock::ErrorQueue
- Extended by:
- DRb::DRbUndumped
- Includes:
- DRb::DRbUndumped
- Defined in:
- lib/stripe_mock/error_queue.rb
Instance Method Summary collapse
- #dequeue ⇒ Object
- #error_for_handler_name(handler_name) ⇒ Object
-
#initialize ⇒ ErrorQueue
constructor
A new instance of ErrorQueue.
- #queue(error, handler_names) ⇒ Object
Constructor Details
#initialize ⇒ ErrorQueue
Returns a new instance of ErrorQueue.
8 9 10 |
# File 'lib/stripe_mock/error_queue.rb', line 8 def initialize @queue = [] end |
Instance Method Details
#dequeue ⇒ Object
22 23 24 |
# File 'lib/stripe_mock/error_queue.rb', line 22 def dequeue @queue.shift end |
#error_for_handler_name(handler_name) ⇒ Object
16 17 18 19 20 |
# File 'lib/stripe_mock/error_queue.rb', line 16 def error_for_handler_name(handler_name) return nil if @queue.count == 0 triggers = @queue.first (triggers.assoc(:all) || triggers.assoc(handler_name) || [])[1] end |
#queue(error, handler_names) ⇒ Object
12 13 14 |
# File 'lib/stripe_mock/error_queue.rb', line 12 def queue(error, handler_names) @queue << handler_names.map {|n| [n, error]} end |