Exception: WebsocketRails::EventRoutingError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/websocket-rails.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event, controller, method) ⇒ EventRoutingError

Returns a new instance of EventRoutingError.



63
64
65
66
# File 'lib/websocket-rails.rb', line 63

def initialize(event, controller, method)
  @event = event
  @controller = controller
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



61
62
63
# File 'lib/websocket-rails.rb', line 61

def controller
  @controller
end

#eventObject (readonly)

Returns the value of attribute event.



61
62
63
# File 'lib/websocket-rails.rb', line 61

def event
  @event
end

#methodObject (readonly)

Returns the value of attribute method.



61
62
63
# File 'lib/websocket-rails.rb', line 61

def method
  @method
end

Instance Method Details

#to_jsonObject



75
76
77
78
79
80
81
82
# File 'lib/websocket-rails.rb', line 75

def to_json
  super({
    :error => "EventRoutingError",
    :event => event.name,
    :method => method,
    :reason => "Controller #{controller.class} does not respond to #{method}"
  })
end

#to_sObject



68
69
70
71
72
73
# File 'lib/websocket-rails.rb', line 68

def to_s
  out =  "Routing Error:\n"
  out << "Event: #{event.name}\n"
  out << "Controller #{controller.class} does not respond to #{method}"
  out
end