class Convoy::Formatter::CursorPosition
Attributes
max_line_width[R]
position[R]
Public Class Methods
new(max_line_width)
click to toggle source
# File lib/convoy/formatter/cursor_position.rb, line 6 def initialize(max_line_width) @max_line_width = max_line_width reset end
Public Instance Methods
chars_to_end_of_line()
click to toggle source
# File lib/convoy/formatter/cursor_position.rb, line 24 def chars_to_end_of_line max_line_width - position end
newline?()
click to toggle source
# File lib/convoy/formatter/cursor_position.rb, line 16 def newline? @position == 0 end
reset()
click to toggle source
# File lib/convoy/formatter/cursor_position.rb, line 20 def reset @position = 0 end
update_for(string)
click to toggle source
# File lib/convoy/formatter/cursor_position.rb, line 11 def update_for(string) @position += string.length raise Convoy::InternalError.new("Cursor position for help output is out of bounds") if position > max_line_width end