Class: Hakuban::ManagedObjectBase

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#asyncObject

Returns the value of attribute async.



193
194
195
# File 'lib/hakuban/manager.rb', line 193

def async
  @async
end

#current_delay_indexObject

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

#descriptorObject (readonly)

Returns the value of attribute descriptor.



192
193
194
# File 'lib/hakuban/manager.rb', line 192

def descriptor
  @descriptor
end

#earliest_next_runObject

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_atObject

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

#runningObject

Returns the value of attribute running.



193
194
195
# File 'lib/hakuban/manager.rb', line 193

def running
  @running
end

Instance Method Details

#changeObject



219
220
221
# File 'lib/hakuban/manager.rb', line 219

def change
	@changes.push(:change)
end

#next_changeObject



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_eventObject



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

#stopObject



223
224
225
# File 'lib/hakuban/manager.rb', line 223

def stop
	@changes.push(:stop)
end