Method: TTY::Reader::Line#initialize

Defined in:
lib/tty/reader/line.rb

#initialize(text = "", prompt: "") {|_self| ... } ⇒ Line

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a Line instance

Yields:

  • (_self)

Yield Parameters:

[View source]

40
41
42
43
44
45
46
47
# File 'lib/tty/reader/line.rb', line 40

def initialize(text = "", prompt: "")
  @prompt = prompt.dup
  @text   = text.dup
  @cursor = [0, @text.length].max
  @mode   = :edit

  yield self if block_given?
end