Class: Hakuban::ObjectExpose::ManagedObject

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

Instance Attribute Summary

Attributes inherited from ManagedObjectBase

#async, #current_delay_index, #descriptor, #earliest_next_run, #last_exception_at, #running

Instance Method Summary collapse

Methods inherited from ManagedObjectBase

#change, #next_change, #next_event, #stop

Constructor Details

#initialize(contract, descriptor) ⇒ ManagedObject

Returns a new instance of ManagedObject.



259
260
261
262
# File 'lib/hakuban/manager.rb', line 259

def initialize(contract, descriptor)
	super(contract, descriptor)
	@assignment = contract.assignment
end

Instance Method Details

#assigned?Boolean

Returns:

  • (Boolean)


278
279
280
# File 'lib/hakuban/manager.rb', line 278

def assigned?
	@contract.assigned?()
end

#assignementObject



274
275
276
# File 'lib/hakuban/manager.rb', line 274

def assignement
	@assignment = @contract.assignment()
end

#check_activeObject



300
301
302
# File 'lib/hakuban/manager.rb', line 300

def check_active
	assigned?
end

#data=(value) ⇒ Object



296
297
298
# File 'lib/hakuban/manager.rb', line 296

def data=(value)
	set_data(value)
end

#do_change(change) ⇒ Object



269
270
271
272
# File 'lib/hakuban/manager.rb', line 269

def do_change(change)
	@assignment = @contract.assignment
	super(change)
end

#run(handler) ⇒ Object



264
265
266
267
# File 'lib/hakuban/manager.rb', line 264

def run(handler)
	super
	@contract.desynchronize(@assignment)
end

#set_data(value) ⇒ Object



291
292
293
294
# File 'lib/hakuban/manager.rb', line 291

def set_data(value)
	timestamp = Time.new.to_f
	set_state([1, timestamp.floor, ((timestamp - timestamp.floor)*1000000000).floor, 0],value)
end

#set_state(*state, **kwargs) ⇒ Object



282
283
284
285
# File 'lib/hakuban/manager.rb', line 282

def set_state(*state, **kwargs)
	kwargs[:assignment] ||= @assignment
	@contract.set_object_state(*state, **kwargs)
end

#state=(state) ⇒ Object



287
288
289
# File 'lib/hakuban/manager.rb', line 287

def state=(state)
	set_state(*state)
end