Class: Pbw::AttachedProcess
- Inherits:
-
Object
- Object
- Pbw::AttachedProcess
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- app/models/pbw/attached_process.rb
Instance Method Summary collapse
Instance Method Details
#tick! ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/pbw/attached_process.rb', line 17 def tick! return unless self.tickable && self.process && (self.token || self.area) unless self.ticks_waiting > 0 self.process.run!(token_or_area) destroy else self.ticks_waiting = self.ticks_waiting - 1 save! end end |
#token_or_area ⇒ Object
39 40 41 |
# File 'app/models/pbw/attached_process.rb', line 39 def token_or_area self.token || self.area end |
#update! ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'app/models/pbw/attached_process.rb', line 28 def update! return unless self.updatable && self.process && (self.token || self.area) unless self.updates_waiting > 0 self.process.run!(token_or_area) destroy else self.updates_waiting = self.updates_waiting - 1 save! end end |