Class: TTYString::Code::SlashB

Inherits:
TTYString::Code show all
Defined in:
lib/tty_string/code_definitions.rb

Overview

leftovers:allow

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TTYString::Code

char, descendants, inherited, #initialize, render

Constructor Details

This class inherits a constructor from TTYString::Code

Class Method Details

.match?(scanner) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
# File 'lib/tty_string/code_definitions.rb', line 15

def self.match?(scanner)
  # can't use `scan(/\b/)` because it matches everything
  return false unless scanner.peek(1) == "\b"

  scanner.pos += 1
  true
end

Instance Method Details

#actionObject



23
24
25
26
# File 'lib/tty_string/code_definitions.rb', line 23

def action
  cursor.left
  screen.clear_at_cursor
end