Class: Kitchen::Instance::FSM
- Inherits:
-
Object
- Object
- Kitchen::Instance::FSM
- Defined in:
- lib/kitchen/instance.rb
Overview
The simplest finite state machine pseudo-implementation needed to manage an Instance.
Class Method Summary collapse
-
.actions(last = nil, desired) ⇒ Array<Symbol>
Returns an Array of all transitions to bring an Instance from its last reported transistioned state into the desired transitioned state.
Class Method Details
.actions(last = nil, desired) ⇒ Array<Symbol>
Returns an Array of all transitions to bring an Instance from its last reported transistioned state into the desired transitioned state.
342 343 344 345 346 347 348 349 350 351 |
# File 'lib/kitchen/instance.rb', line 342 def self.actions(last = nil, desired) last_index = index(last) desired_index = index(desired) if last_index == desired_index || last_index > desired_index Array(TRANSITIONS[desired_index]) else TRANSITIONS.slice(last_index + 1, desired_index - last_index) end end |