Sha256: 5233ba04b41d78b6204b2dc8e28a993bd4d10ad185c08cbe7c84c47c882be1a3
Contents?: true
Size: 992 Bytes
Versions: 6
Compression:
Stored size: 992 Bytes
Contents
# encoding: utf-8 class ElectricSlide class AgentStrategy class LongestIdle def initialize @free_agents = [] # Needed to keep track of waiting order end # Checks whether an agent is available to take a call # @return [Boolean] True if an agent is available def agent_available? @free_agents.count > 0 end # Returns a count of the number of available agents # @return [Hash] Hash of information about available agents # This strategy only returns the count of agents available with :total def available_agent_summary { total: @free_agents.count } end # Assigns the first available agent, marking the agent :on_call # @return {Agent} def checkout_agent @free_agents.shift end def <<(agent) @free_agents << agent unless @free_agents.include?(agent) end def delete(agent) @free_agents.delete(agent) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems