Class: Warg::Console::CursorPosition
- Inherits:
-
Object
- Object
- Warg::Console::CursorPosition
- Defined in:
- lib/warg.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#row ⇒ Object
Returns the value of attribute row.
Instance Method Summary collapse
- #adjust_to(content) ⇒ Object
-
#initialize ⇒ CursorPosition
constructor
A new instance of CursorPosition.
- #inspect ⇒ Object
Constructor Details
#initialize ⇒ CursorPosition
Returns a new instance of CursorPosition.
254 255 256 257 |
# File 'lib/warg.rb', line 254 def initialize @row = 1 @column = 1 end |
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
251 252 253 |
# File 'lib/warg.rb', line 251 def column @column end |
#row ⇒ Object
Returns the value of attribute row.
252 253 254 |
# File 'lib/warg.rb', line 252 def row @row end |
Instance Method Details
#adjust_to(content) ⇒ Object
259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/warg.rb', line 259 def adjust_to(content) last_line_length = content.last_line_length newline_count = content.newline_count if newline_count > 0 @column = last_line_length + 1 else @column += last_line_length end @row += newline_count end |
#inspect ⇒ Object
272 273 274 |
# File 'lib/warg.rb', line 272 def inspect %{#<#{self.class.name} row=#{row} column=#{column}>} end |