Class: WEEL::Status
- Inherits:
-
Object
- Object
- WEEL::Status
- Defined in:
- lib/weel.rb
Overview
}}}
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(id, message) ⇒ Status
constructor
{{{.
- #nudge! ⇒ Object
- #to_json(*a) ⇒ Object
- #update(id, message) ⇒ Object
- #wait_until_nudged! ⇒ Object
Constructor Details
#initialize(id, message) ⇒ Status
{{{
241 242 243 244 245 |
# File 'lib/weel.rb', line 241 def initialize(id,) @id = id @message = @nudge = Queue.new end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
264 265 266 |
# File 'lib/weel.rb', line 264 def id @id end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
264 265 266 |
# File 'lib/weel.rb', line 264 def @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,) @id = id @message = end |
#wait_until_nudged! ⇒ Object
255 256 257 |
# File 'lib/weel.rb', line 255 def wait_until_nudged! @nudge.pop end |