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.
196 197 198 199 200 |
# File 'lib/hakuban/manager.rb', line 196 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.
193 194 195 |
# File 'lib/hakuban/manager.rb', line 193 def async @async end |
#current_delay_index ⇒ Object
Returns the value of attribute current_delay_index.
193 194 195 |
# File 'lib/hakuban/manager.rb', line 193 def current_delay_index @current_delay_index end |
#descriptor ⇒ Object (readonly)
Returns the value of attribute descriptor.
192 193 194 |
# File 'lib/hakuban/manager.rb', line 192 def descriptor @descriptor end |
#earliest_next_run ⇒ Object
Returns the value of attribute earliest_next_run.
193 194 195 |
# File 'lib/hakuban/manager.rb', line 193 def earliest_next_run @earliest_next_run end |
#last_exception_at ⇒ Object
Returns the value of attribute last_exception_at.
193 194 195 |
# File 'lib/hakuban/manager.rb', line 193 def last_exception_at @last_exception_at end |
#running ⇒ Object
Returns the value of attribute running.
193 194 195 |
# File 'lib/hakuban/manager.rb', line 193 def running @running end |
Instance Method Details
#change ⇒ Object
219 220 221 |
# File 'lib/hakuban/manager.rb', line 219 def change @changes.push(:change) end |
#next_change ⇒ Object
209 210 211 212 213 214 215 216 |
# File 'lib/hakuban/manager.rb', line 209 def next_change loop { case @changes.shift when :change then return true when :stop then return false end } end |
#next_event ⇒ Object
208 |
# File 'lib/hakuban/manager.rb', line 208 def next_event; next_change; end |
#run(handler) ⇒ Object
203 204 205 |
# File 'lib/hakuban/manager.rb', line 203 def run(handler) handler.call(self) end |
#stop ⇒ Object
223 224 225 |
# File 'lib/hakuban/manager.rb', line 223 def stop @changes.push(:stop) end |