diff --git a/CharacterAdder.md b/CharacterAdder.md new file mode 100644 index 0000000..fc0b91f --- /dev/null +++ b/CharacterAdder.md @@ -0,0 +1,17 @@ +# CharacterAdder Class + +The `CharacterAdder` class is responsible for adding characters to the input string in the DynamicCursesInput gem. It provides a method to add a character at the current cursor position. + +## Methods + +### .add(chk, input, cursor_pos) + +This is a class method that adds a character at the current cursor position. It takes three parameters: + +- `chk`: the character to be added. +- `input`: the current input string. +- `cursor_pos`: the current cursor position. + +The method inserts the character at the cursor position and increases the cursor position by 1. This simulates the effect of typing a character at the cursor's position in a text editor. + +The method returns an array containing two elements: the updated input string and the updated cursor position.