Class: Hakuban::ObjectExpose::ExposedObject

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

Instance Attribute Summary

Attributes inherited from ManagedObject

#async, #descriptor, #handler_already_run

Instance Method Summary collapse

Methods inherited from ManagedObject

#next_change, #next_event

Constructor Details

#initialize(contract, descriptor) ⇒ ExposedObject

Returns a new instance of ExposedObject.



163
164
165
166
# File 'lib/hakuban/manager.rb', line 163

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

Instance Method Details

#assigned?Boolean

Returns:

  • (Boolean)


182
183
184
# File 'lib/hakuban/manager.rb', line 182

def assigned?
  @contract.assigned?()
end

#assignementObject



178
179
180
# File 'lib/hakuban/manager.rb', line 178

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

#data=(value) ⇒ Object



200
201
202
# File 'lib/hakuban/manager.rb', line 200

def data=(value)
  set_data(value)
end

#do_change(change) ⇒ Object



173
174
175
176
# File 'lib/hakuban/manager.rb', line 173

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

#run(handler) ⇒ Object



168
169
170
171
# File 'lib/hakuban/manager.rb', line 168

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

#set_data(value) ⇒ Object



195
196
197
198
# File 'lib/hakuban/manager.rb', line 195

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



186
187
188
189
# File 'lib/hakuban/manager.rb', line 186

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

#state=(state) ⇒ Object



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

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