Module: Cursorable
- Included in:
- LiveSQL
- Defined in:
- lib/live_sql/cursorable.rb
Instance Method Summary collapse
Instance Method Details
#backspace ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/live_sql/cursorable.rb', line 19 def backspace if @string.length > 1 @string.slice!(@cursor_pos - 1) @cursor_pos -= 1 unless @cursor_pos == 0 end attempt_to_query_db end |
#delete ⇒ Object
27 28 29 30 31 32 |
# File 'lib/live_sql/cursorable.rb', line 27 def delete if @string.length > 1 @string.slice!(@cursor_pos) end attempt_to_query_db end |
#error ⇒ Object
3 4 |
# File 'lib/live_sql/cursorable.rb', line 3 def error end |
#left ⇒ Object
11 12 13 |
# File 'lib/live_sql/cursorable.rb', line 11 def left @cursor_pos -= 1 unless @cursor_pos == 0 end |
#quit ⇒ Object
6 7 8 9 |
# File 'lib/live_sql/cursorable.rb', line 6 def quit system("clear") abort end |
#right ⇒ Object
15 16 17 |
# File 'lib/live_sql/cursorable.rb', line 15 def right @cursor_pos += 1 unless @cursor_pos == @string.length - 1 end |