class Tantot::Agent::Registry
Public Class Methods
new()
click to toggle source
# File lib/tantot/agent/registry.rb, line 6 def initialize @agents = {} end
Public Instance Methods
agent(agent_id)
click to toggle source
# File lib/tantot/agent/registry.rb, line 19 def agent(agent_id) @agents[agent_id.to_s] end
clear()
click to toggle source
# File lib/tantot/agent/registry.rb, line 29 def clear @agents.clear end
each_agent() { |agent| ... }
click to toggle source
# File lib/tantot/agent/registry.rb, line 23 def each_agent @agents.values.each do |agent| yield agent end end
register(watch)
click to toggle source
# File lib/tantot/agent/registry.rb, line 10 def register(watch) agent_class, watch_id = Tantot::Agent.resolve!(watch) agent = @agents.fetch(watch_id.to_s) do agent_class.new(watch_id).tap {|new_agent| @agents[watch_id.to_s] = new_agent} end agent.add_watch(watch) agent end