class Fake::InfiniteQueue

Queue which returns last value forever

Public Class Methods

new() click to toggle source
# File lib/fake_service.rb, line 20
def initialize
  @current_item_index = 0
  @items = []
end

Public Instance Methods

<<(item) click to toggle source
# File lib/fake_service.rb, line 25
def <<(item)
  @items << item
end
next() click to toggle source
# File lib/fake_service.rb, line 29
def next
  item = @items[@current_item_index]
  @current_item_index += 1 if @current_item_index < (@items.count - 1)
  item
end