Class: Hakuban::ObjectManager::ExposedObject

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

Instance Attribute Summary

Attributes inherited from ManagedObject

#contract, #descriptor

Instance Method Summary collapse

Methods inherited from ManagedObject

#initialize

Constructor Details

This class inherits a constructor from Hakuban::ObjectManager::ManagedObject

Instance Method Details

#data=(value) ⇒ Object



641
642
643
# File 'lib/hakuban/hakuban.rb', line 641

def data=(value)
  data_set(value)
end

#data_set(value) ⇒ Object



633
634
635
636
637
638
639
640
# File 'lib/hakuban/hakuban.rb', line 633

def data_set(value)
  timestamp = Time.new.to_f
  if @contract.method(:set_object_state).arity == 4
    @contract.set_object_state(@descriptor,[1, timestamp.floor, ((timestamp - timestamp.floor)*1000000000).floor, 0],[],value)
  else 
    @contract.set_object_state([1, timestamp.floor, ((timestamp - timestamp.floor)*1000000000).floor, 0],[],value)
  end
end

#state=(state) ⇒ Object



630
631
632
# File 'lib/hakuban/hakuban.rb', line 630

def state=(state)
  state_set(state)
end

#state_set(state) ⇒ Object



623
624
625
626
627
628
629
# File 'lib/hakuban/hakuban.rb', line 623

def state_set(state)
  if @contract.method(:set_object_state).arity == 4
    @contract.set_object_state(@descriptor, *state)
  else
    @contract.set_object_state(*state)
  end
end