Class: WEEL::Status

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

Overview

}}}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, message) ⇒ Status

{{{



241
242
243
244
245
# File 'lib/weel.rb', line 241

def initialize(id,message)
  @id      = id
  @message = message
  @nudge   = Queue.new
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



264
265
266
# File 'lib/weel.rb', line 264

def id
  @id
end

#messageObject (readonly)

Returns the value of attribute message.



264
265
266
# File 'lib/weel.rb', line 264

def message
  @message
end

Instance Method Details

#nudge!Object



250
251
252
253
254
# File 'lib/weel.rb', line 250

def nudge!
  1.upto(@nudge.num_waiting) do
    @nudge.push(nil)
  end
end

#to_json(*a) ⇒ Object



258
259
260
261
262
263
# File 'lib/weel.rb', line 258

def to_json(*a)
  {
    'id' => @id,
    'message' => @message
  }.to_json(*a)
end

#update(id, message) ⇒ Object



246
247
248
249
# File 'lib/weel.rb', line 246

def update(id,message)
  @id      = id
  @message = message
end

#wait_until_nudged!Object



255
256
257
# File 'lib/weel.rb', line 255

def wait_until_nudged!
  @nudge.pop
end