Class: SocketCake
- Inherits:
-
Object
- Object
- SocketCake
- Defined in:
- lib/socketcake.rb
Defined Under Namespace
Classes: BaseSocket, WsTask
Instance Attribute Summary collapse
-
#storage ⇒ Object
Returns the value of attribute storage.
-
#task_list ⇒ Object
Returns the value of attribute task_list.
Instance Method Summary collapse
-
#initialize(cookie, task_list = []) ⇒ SocketCake
constructor
A new instance of SocketCake.
- #roll ⇒ Object
Constructor Details
#initialize(cookie, task_list = []) ⇒ SocketCake
Returns a new instance of SocketCake.
7 8 9 10 11 |
# File 'lib/socketcake.rb', line 7 def initialize , task_list=[] = @task_list = task_list @storage = Hash.new end |
Instance Attribute Details
#storage ⇒ Object
Returns the value of attribute storage.
5 6 7 |
# File 'lib/socketcake.rb', line 5 def storage @storage end |
#task_list ⇒ Object
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
#roll ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/socketcake.rb', line 13 def roll EM.run do create_sockets @task_list task_list.each do |task| t = self.instance_variable_get(:"@#{task.name.downcase}") t.start { |data| @storage[t.class.to_s]=data; EM.stop if task == task_list.last } end end end |