Sha256: c68a408fa56acc84873e87302830af05c997beed1270d2508d70a477d230f755
Contents?: true
Size: 729 Bytes
Versions: 6
Compression:
Stored size: 729 Bytes
Contents
module Bubbles class CommandQueue extend Forwardable def_delegators :queue, :size def initialize(config:) @config = config end def queue @queue ||= [] end def <<(command_object) queue << command_object end def call_next if command = queue.shift log command command.call else log "Nothing in the command queue" end end def reschedule(command_object) queue.unshift(command_object) end def inspect "<##{self.class.name} queue:#{queue.inspect} >" end private attr_reader :config def log(command) config.logger.debug("Processing: #{command.inspect}") end end end
Version data entries
6 entries across 6 versions & 1 rubygems