lib/jpc/handler.rb in jpc-1.2.0 vs lib/jpc/handler.rb in jpc-1.2.1

- old
+ new

@@ -1,30 +1,32 @@ -class JPC::Handler - attr_accessor :token +module JPC + class Handler + attr_accessor :token - def initialize(ws = nil, dispatcher = nil) - @ws = ws - @dispatcher = dispatcher - end + def initialize(ws, dispatcher) + @ws = ws + @dispatcher = dispatcher + end - def ping(params = {}) - "pong #{params}" - end + def ping(params = {}) + "pong #{params}" + end - def subscribe(channel) - @dispatcher.subscribe(@ws, channel) - end + def subscribe(channel) + @dispatcher.subscribe(@ws, channel) + end - def unsubscribe(channel) - @dispatcher.unsubscribe(@ws, channel) - end + def unsubscribe(channel) + @dispatcher.unsubscribe(@ws, channel) + end - private + private - def allowed_methods - procedures + %w(ping subscribe unsubscribe) - end + def allowed_methods + procedures + %w(ping subscribe unsubscribe) + end - def procedures - [] + def procedures + [] + end end end