Method: Tap::App::State.state_str

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

.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