Sha256: 28a4d431b890bbdf78241395c8b224533a187f777ce68ff96505992b60e6e94d
Contents?: true
Size: 383 Bytes
Versions: 4
Compression:
Stored size: 383 Bytes
Contents
# frozen_string_literal: true module CottonTail # Register message handlers and dispatch messages to them class Router def self.call new end def initialize @handlers = {} end def route(key, handler) @handlers[key] = handler end def dispatch(key, *args) @handlers[key].call(*args) end alias call dispatch end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cotton-tail-0.2.1 | lib/cotton_tail/router.rb |
cotton-tail-0.2.0 | lib/cotton_tail/router.rb |
cotton-tail-0.1.2 | lib/cotton_tail/router.rb |
cotton-tail-0.1.1 | lib/cotton_tail/router.rb |