Class: Hakuban::ManagedObjectBase
- Inherits:
-
Object
- Object
- Hakuban::ManagedObjectBase
- Defined in:
- lib/hakuban/manager.rb
Direct Known Subclasses
ObjectExpose::ManagedObject, ObjectObserve::ManagedObject, TagExpose::ManagedObject, TagObserve::ManagedObject
Instance Attribute Summary collapse
-
#async ⇒ Object
Returns the value of attribute async.
-
#current_delay_index ⇒ Object
Returns the value of attribute current_delay_index.
-
#descriptor ⇒ Object
readonly
Returns the value of attribute descriptor.
-
#earliest_next_run ⇒ Object
Returns the value of attribute earliest_next_run.
-
#last_exception_at ⇒ Object
Returns the value of attribute last_exception_at.
-
#running ⇒ Object
Returns the value of attribute running.
Instance Method Summary collapse
- #change ⇒ Object
-
#initialize(contract, descriptor) ⇒ ManagedObjectBase
constructor
A new instance of ManagedObjectBase.
- #next_change ⇒ Object
- #next_event ⇒ Object
- #run(handler) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(contract, descriptor) ⇒ ManagedObjectBase
Returns a new instance of ManagedObjectBase.
193 194 195 196 197 |
# File 'lib/hakuban/manager.rb', line 193 def initialize(contract, descriptor) @contract,@descriptor = contract, descriptor @changes = Queue.new @current_delay_index = 0 end |
Instance Attribute Details
#async ⇒ Object
Returns the value of attribute async.
190 191 192 |
# File 'lib/hakuban/manager.rb', line 190 def async @async end |
#current_delay_index ⇒ Object
Returns the value of attribute current_delay_index.
190 191 192 |
# File 'lib/hakuban/manager.rb', line 190 def current_delay_index @current_delay_index end |
#descriptor ⇒ Object (readonly)
Returns the value of attribute descriptor.
189 190 191 |
# File 'lib/hakuban/manager.rb', line 189 def descriptor @descriptor end |
#earliest_next_run ⇒ Object
Returns the value of attribute earliest_next_run.
190 191 192 |
# File 'lib/hakuban/manager.rb', line 190 def earliest_next_run @earliest_next_run end |
#last_exception_at ⇒ Object
Returns the value of attribute last_exception_at.
190 191 192 |
# File 'lib/hakuban/manager.rb', line 190 def last_exception_at @last_exception_at end |
#running ⇒ Object
Returns the value of attribute running.
190 191 192 |
# File 'lib/hakuban/manager.rb', line 190 def running @running end |
Instance Method Details
#change ⇒ Object
216 217 218 |
# File 'lib/hakuban/manager.rb', line 216 def change @changes.push(:change) end |
#next_change ⇒ Object
206 207 208 209 210 211 212 213 |
# File 'lib/hakuban/manager.rb', line 206 def next_change loop { case @changes.shift when :change then return true when :stop then return false end } end |
#next_event ⇒ Object
205 |
# File 'lib/hakuban/manager.rb', line 205 def next_event; next_change; end |
#run(handler) ⇒ Object
200 201 202 |
# File 'lib/hakuban/manager.rb', line 200 def run(handler) handler.call(self) end |
#stop ⇒ Object
220 221 222 |
# File 'lib/hakuban/manager.rb', line 220 def stop @changes.push(:stop) end |