module Rvm2::Ui::Output::Console::ConsoleIO

Attributes

was_new_line[RW]

Public Instance Methods

console_parent=(value) click to toggle source
# File lib/plugins/rvm2/ui/output/console.rb, line 11
def console_parent=(value)
  @was_new_line = true
  @console_parent = value
end
indent(string) click to toggle source
# File lib/plugins/rvm2/ui/output/console.rb, line 22
def indent(string)
  if levels > 0
    ends_with_n = string.end_with?("\n")
    string = string.split(/\n/).map do |s|
      s.sub(/^(\r?)/,"\\1#{"  "*levels}")
    end.join("\n")
    string << "\n" if ends_with_n
  end
  string
end
levels() click to toggle source
# File lib/plugins/rvm2/ui/output/console.rb, line 33
def levels
  @console_parent.levels
end
winsize() click to toggle source
Calls superclass method
# File lib/plugins/rvm2/ui/output/console.rb, line 37
def winsize
  rows, columns = super
  [rows, columns - levels*2]
rescue
  nil
end
write(string) click to toggle source
Calls superclass method
# File lib/plugins/rvm2/ui/output/console.rb, line 16
def write(string)
  super("\n") if !@was_new_line and !string.start_with?("\r")
  super(indent(string))
  @was_new_line = true
end