Class: SocketCake

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

Defined Under Namespace

Classes: BaseSocket, WsTask

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cookie, task_list = []) ⇒ SocketCake

Returns a new instance of SocketCake.



6
7
8
9
10
# File 'lib/socketcake.rb', line 6

def initialize cookie,task_list=[]
    @cookie = cookie
    @task_list = task_list
    @storage = Hash.new
end

Instance Attribute Details

#storageObject

Returns the value of attribute storage.



5
6
7
# File 'lib/socketcake.rb', line 5

def storage
  @storage
end

#task_listObject

Returns the value of attribute task_list.



5
6
7
# File 'lib/socketcake.rb', line 5

def task_list
  @task_list
end

Instance Method Details

#rollObject



12
13
14
15
16
17
18
19
20
# File 'lib/socketcake.rb', line 12

def roll
    EM.run do
        create_sockets @task_list
            ObjectSpace.each_object(BaseSocket).each do |t|
            t.start {|data| @storage[t.class.to_s]=data}
        end
        EM.stop
    end
end