Class: TTYtest::Capture
Constant Summary
Constants included
from Matchers
Matchers::METHODS
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Matchers
#assert_cursor_hidden, #assert_cursor_position, #assert_cursor_visible, #assert_row
Constructor Details
#initialize(contents, cursor_x: 0, cursor_y: 0, width: nil, height: nil, cursor_visible: true) ⇒ Capture
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/ttytest/capture.rb', line 8
def initialize(contents, cursor_x: 0, cursor_y: 0, width: nil, height: nil, cursor_visible: true)
@rows = (contents+"\nEND").split("\n")[0...-1].map do |row|
row || ""
end
@cursor_x = cursor_x
@cursor_y = cursor_y
@width = width
@height = height
@cursor_visible = cursor_visible
end
|
Instance Attribute Details
#cursor_x ⇒ Object
Returns the value of attribute cursor_x.
5
6
7
|
# File 'lib/ttytest/capture.rb', line 5
def cursor_x
@cursor_x
end
|
#cursor_y ⇒ Object
Returns the value of attribute cursor_y.
5
6
7
|
# File 'lib/ttytest/capture.rb', line 5
def cursor_y
@cursor_y
end
|
#height ⇒ Object
Returns the value of attribute height.
6
7
8
|
# File 'lib/ttytest/capture.rb', line 6
def height
@height
end
|
#width ⇒ Object
Returns the value of attribute width.
6
7
8
|
# File 'lib/ttytest/capture.rb', line 6
def width
@width
end
|
Instance Method Details
#capture ⇒ Object
39
40
41
|
# File 'lib/ttytest/capture.rb', line 39
def capture
self
end
|
#cursor_hidden? ⇒ Boolean
35
36
37
|
# File 'lib/ttytest/capture.rb', line 35
def cursor_hidden?
!cursor_visible?
end
|
#cursor_position ⇒ Object
19
20
21
|
# File 'lib/ttytest/capture.rb', line 19
def cursor_position
[@cursor_x, @cursor_y]
end
|
#cursor_visible? ⇒ Boolean
31
32
33
|
# File 'lib/ttytest/capture.rb', line 31
def cursor_visible?
@cursor_visible
end
|
#row(row) ⇒ Object
27
28
29
|
# File 'lib/ttytest/capture.rb', line 27
def row(row)
rows[row]
end
|
#rows ⇒ Object
23
24
25
|
# File 'lib/ttytest/capture.rb', line 23
def rows
@rows
end
|
#to_s ⇒ Object
43
44
45
|
# File 'lib/ttytest/capture.rb', line 43
def to_s
rows.join("\n")
end
|