Sha256: 2cecce965467f705f34147d643ea896d979f245c8919721cb4663d87cad4bb3c
Contents?: true
Size: 761 Bytes
Versions: 2
Compression:
Stored size: 761 Bytes
Contents
# frozen_string_literal: true require "wsdirector/protocols/base" require "wsdirector/protocols/action_cable" module WSDirector ID2CLASS = { "base" => "Base", "action_cable" => "ActionCable" }.freeze module Protocols # :nodoc: # Raised when received not expected message class UnmatchedExpectationError < WSDirector::Error; end # Raised when received message is unexpected class UnexpectedMessageError < WSDirector::Error; end # Raised when nothing has been received class NoMessageError < WSDirector::Error; end class << self def get(id) raise Error, "Unknown protocol: #{id}" unless ID2CLASS.key?(id) class_name = ID2CLASS.fetch(id) const_get(class_name) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wsdirector-cli-0.4.0 | lib/wsdirector/protocols.rb |
wsdirector-cli-0.3.0 | lib/wsdirector/protocols.rb |