Class: JarEd::Screen

Inherits:
Object
  • Object
show all
Defined in:
lib/jared/screen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lines:, cursor_column:, cursor_row:) ⇒ Screen

TODO:

Rename these to cursor_row/column

Returns a new instance of Screen.



6
7
8
9
10
# File 'lib/jared/screen.rb', line 6

def initialize(lines:, cursor_column:, cursor_row:)
  @lines = lines
  @cursor_column = cursor_column
  @cursor_row = cursor_row
end

Instance Attribute Details

#cursor_columnObject (readonly)

Returns the value of attribute cursor_column.



3
4
5
# File 'lib/jared/screen.rb', line 3

def cursor_column
  @cursor_column
end

#cursor_rowObject (readonly)

Returns the value of attribute cursor_row.



3
4
5
# File 'lib/jared/screen.rb', line 3

def cursor_row
  @cursor_row
end

#linesObject (readonly)

Returns the value of attribute lines.



3
4
5
# File 'lib/jared/screen.rb', line 3

def lines
  @lines
end

Instance Method Details

#heightObject



16
17
18
# File 'lib/jared/screen.rb', line 16

def height
  lines.length
end

#widthObject



12
13
14
# File 'lib/jared/screen.rb', line 12

def width
  lines.map(&:length).max
end