Class: ShenmeGUI::FakeSocket

Inherits:
Object
  • Object
show all
Defined in:
lib/shenmegui/core.rb

Overview

FakeSocket把send的内容都记录下来,在WebSocket连接建立时会将这些消息读出,转发到ws上

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFakeSocket

Returns a new instance of FakeSocket.



11
12
13
# File 'lib/shenmegui/core.rb', line 11

def initialize
  @messages = []
end

Instance Attribute Details

#messagesObject (readonly)

Returns the value of attribute messages.



10
11
12
# File 'lib/shenmegui/core.rb', line 10

def messages
  @messages
end

Instance Method Details

#send(msg) ⇒ Object



14
15
16
# File 'lib/shenmegui/core.rb', line 14

def send(msg)
  @messages << msg
end