Class: DynamicCursesInput::CharacterAdder

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamic_curses_input/input_handler.rb

Overview

Class for adding characters

Class Method Summary collapse

Class Method Details

.add(chk, input, cursor_pos) ⇒ Object

Add character at cursor position



149
150
151
152
153
# File 'lib/dynamic_curses_input/input_handler.rb', line 149

def self.add(chk, input, cursor_pos)
  input = input[0...cursor_pos] + chk + input[cursor_pos..]
  cursor_pos += 1
  [input, cursor_pos]
end