Class: RailsLiveReload::WebSocket::MessageBuffer
- Inherits:
-
Object
- Object
- RailsLiveReload::WebSocket::MessageBuffer
- Defined in:
- lib/rails_live_reload/web_socket/message_buffer.rb
Overview
This class is basically copied from ActionCable github.com/rails/rails/blob/v7.0.3/actioncable/lib/action_cable/connection/message_buffer.rb
Instance Method Summary collapse
- #append(message) ⇒ Object
-
#initialize(connection) ⇒ MessageBuffer
constructor
A new instance of MessageBuffer.
- #process! ⇒ Object
- #processing? ⇒ Boolean
Constructor Details
#initialize(connection) ⇒ MessageBuffer
Returns a new instance of MessageBuffer.
6 7 8 9 |
# File 'lib/rails_live_reload/web_socket/message_buffer.rb', line 6 def initialize(connection) @connection = connection = [] end |
Instance Method Details
#append(message) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rails_live_reload/web_socket/message_buffer.rb', line 11 def append() if valid? if processing? receive else buffer end else raise ArgumentError, "Couldn't handle non-string message: #{message.class}" end end |
#process! ⇒ Object
27 28 29 30 |
# File 'lib/rails_live_reload/web_socket/message_buffer.rb', line 27 def process! @processing = true end |
#processing? ⇒ Boolean
23 24 25 |
# File 'lib/rails_live_reload/web_socket/message_buffer.rb', line 23 def processing? @processing end |