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.



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

#asyncObject

Returns the value of attribute async.



190
191
192
# File 'lib/hakuban/manager.rb', line 190

def async
  @async
end

#current_delay_indexObject

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

#descriptorObject (readonly)

Returns the value of attribute descriptor.



189
190
191
# File 'lib/hakuban/manager.rb', line 189

def descriptor
  @descriptor
end

#earliest_next_runObject

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_atObject

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

#runningObject

Returns the value of attribute running.



190
191
192
# File 'lib/hakuban/manager.rb', line 190

def running
  @running
end

Instance Method Details

#changeObject



216
217
218
# File 'lib/hakuban/manager.rb', line 216

def change
	@changes.push(:change)
end

#next_changeObject



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_eventObject



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

#stopObject



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

def stop
	@changes.push(:stop)
end