Class: Nestene::AutonContext

Inherits:
Object
  • Object
show all
Defined in:
lib/nestene/auton_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auton_id) ⇒ AutonContext

Returns a new instance of AutonContext.



4
5
6
# File 'lib/nestene/auton_context.rb', line 4

def initialize auton_id
  @auton_id = auton_id
end

Instance Attribute Details

#auton_idObject (readonly)

Returns the value of attribute auton_id.



43
44
45
# File 'lib/nestene/auton_context.rb', line 43

def auton_id
  @auton_id
end

#steps_to_scheduleObject

Returns the value of attribute steps_to_schedule.



8
9
10
# File 'lib/nestene/auton_context.rb', line 8

def steps_to_schedule
  @steps_to_schedule
end

Instance Method Details

#create_auton(type, auton_id = SecureRandom.uuid) ⇒ Object



35
36
37
# File 'lib/nestene/auton_context.rb', line 35

def create_auton type, auton_id=SecureRandom.uuid
  Celluloid::Actor[:nestene_core].create_auton type, auton_id
end

#credentialsObject



31
32
33
# File 'lib/nestene/auton_context.rb', line 31

def credentials
  Celluloid::Actor[:nestene_core].get_credentials
end

#schedule_callback(auton_id, method, parameters, callback_method) ⇒ Object



10
11
12
# File 'lib/nestene/auton_context.rb', line 10

def schedule_callback auton_id, method, parameters, callback_method
  Celluloid::Actor[:nestene_core].schedule_step auton_id, method, parameters, @auton_id, callback_method
end

#schedule_delayed_step(delay, name, parameters = []) ⇒ Object



23
24
25
# File 'lib/nestene/auton_context.rb', line 23

def schedule_delayed_step delay, name, parameters=[]
  Celluloid::Actor[:nestene_core].schedule_delayed_step @auton_id, delay, name, parameters
end

#schedule_repeating_delayed_step(every, delay, name, parameters = []) ⇒ Object



27
28
29
# File 'lib/nestene/auton_context.rb', line 27

def schedule_repeating_delayed_step every, delay, name, parameters=[]
  Celluloid::Actor[:nestene_core].schedule_repeating_delayed_step @auton_id, every, delay, name, parameters
end

#schedule_step(name, parameters = []) ⇒ Object



14
15
16
# File 'lib/nestene/auton_context.rb', line 14

def schedule_step name, parameters=[]
  Celluloid::Actor[:nestene_core].schedule_step @auton_id, name, parameters
end

#schedule_step_on_auton(auton_id, name, parameters = []) ⇒ Object



18
19
20
# File 'lib/nestene/auton_context.rb', line 18

def schedule_step_on_auton auton_id, name, parameters=[]
  Celluloid::Actor[:nestene_core].schedule_step auton_id, name, parameters
end

#terminateObject



39
40
41
# File 'lib/nestene/auton_context.rb', line 39

def terminate
  schedule_step '__terminate_this_auton'
end