Method: HighLine#initialize

Defined in:
lib/highline.rb

#initialize(input = $stdin, output = $stdout, wrap_at = nil, page_at = nil, indent_size = 3, indent_level = 0) ⇒ HighLine

Create an instance of HighLine connected to the given input and output streams.

Parameters:

  • input (IO) (defaults to: $stdin)

    the default input stream for HighLine.

  • output (IO) (defaults to: $stdout)

    the default output stream for HighLine.

  • wrap_at (Integer) (defaults to: nil)

    all statements outputed through HighLine will be wrapped to this column size if set.

  • page_at (Integer) (defaults to: nil)

    page size and paginating.

  • indent_size (Integer) (defaults to: 3)

    indentation size in spaces.

  • indent_level (Integer) (defaults to: 0)

    how deep is indentated.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/highline.rb', line 109

def initialize(input = $stdin, output = $stdout,
               wrap_at = nil, page_at = nil,
               indent_size = 3, indent_level = 0)
  @input   = input
  @output  = output

  @multi_indent = true
  @indent_size  = indent_size
  @indent_level = indent_level

  self.wrap_at = wrap_at
  self.page_at = page_at

  @header   = nil
  @prompt   = nil
  @key      = nil

  @use_color = default_use_color
  @track_eof = true # The setting used to disable EOF tracking.
  @terminal = HighLine::Terminal.get_terminal(input, output)
end