Module: Tap::App::State

Defined in:
lib/tap/app/state.rb

Overview

The constants defining the possible App states.

Constant Summary collapse

READY =
0
RUN =
1
STOP =
2
TERMINATE =
3

Class Method Summary collapse

Class Method Details

.state_str(state) ⇒ Object

Returns a string corresponding to the input state value.

Returns nil for unknown states.

State.state_str(0)        # => 'READY'
State.state_str(12)       # => nil


17
18
19
20
# File 'lib/tap/app/state.rb', line 17

def state_str(state)
  const = constants.find {|const_name| const_get(const_name) == state }
  const ? const.to_s : nil
end