Class: StateMachine::NewSessionState

Inherits:
Object
  • Object
show all
Defined in:
app/state_machine/new_session_state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(selected_index) ⇒ NewSessionState

Returns a new instance of NewSessionState.



5
6
7
# File 'app/state_machine/new_session_state.rb', line 5

def initialize(selected_index)
  @selected_index = selected_index
end

Instance Attribute Details

#selected_indexObject (readonly)

Returns the value of attribute selected_index.



3
4
5
# File 'app/state_machine/new_session_state.rb', line 3

def selected_index
  @selected_index
end

Instance Method Details

#action(window) ⇒ Object



9
10
11
12
13
14
15
# File 'app/state_machine/new_session_state.rb', line 9

def action(window)
  name = window.getstr

  name = remove_prohibited_chars(name)

  commander.new_session(name)
end

#next_stateObject



17
18
# File 'app/state_machine/new_session_state.rb', line 17

def next_state
end

#to_sObject



20
21
22
# File 'app/state_machine/new_session_state.rb', line 20

def to_s
  "Creating new session"
end