class MiniReadline::Prompt

A class used to hold prompt strings that may contain ANSI terminal control embellishments.

Attributes

length[R]

Get the length without ANSI sequences.

text[R]

Get the text.

Public Class Methods

new(text) click to toggle source

Create a special prompt text.

# File lib/mini_readline/read_line/prompt.rb, line 17
def initialize(text)
  @text = text
  @length = text.gsub(/\x1B\[(\d|;)*[@-~]/, "").length
end

Public Instance Methods

inspect() click to toggle source

Inspect the prompt

# File lib/mini_readline/read_line/prompt.rb, line 23
def inspect
  "<Prompt: #{@text.inspect}>"
end