Module: Draco::Periodic::InstanceMethods

Defined in:
lib/draco/periodic.rb

Overview

Internal: Overrides the tick method to check that we want to run the system on the current tick.

Instance Method Summary collapse

Instance Method Details

#periodObject



22
23
24
# File 'lib/draco/periodic.rb', line 22

def period
  self.class.instance_variable_get(:@period) || 1
end

#tick(context) ⇒ Object



18
19
20
# File 'lib/draco/periodic.rb', line 18

def tick(context)
  super if (context.state.tick_count % period).zero?
end