Class: Twterm::Image::VerticalSequentialImage
Instance Method Summary
collapse
#!, #-, #at, blank_line, #bold, #brackets, checkbox, #color, #column, cursor, empty, #line, number, #parens, plural, remaining_resource, string, whitespace
Constructor Details
Returns a new instance of VerticalSequentialImage.
4
5
6
|
# File 'lib/twterm/image/vertical_sequential_image.rb', line 4
def initialize(images)
@images = images
end
|
Instance Method Details
#append(image) ⇒ Object
12
13
14
15
|
# File 'lib/twterm/image/vertical_sequential_image.rb', line 12
def append(image)
images << image
self
end
|
#height ⇒ Object
17
18
19
|
# File 'lib/twterm/image/vertical_sequential_image.rb', line 17
def height
images.map(&:height).reduce(0, :+)
end
|
#render(window) ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/twterm/image/vertical_sequential_image.rb', line 21
def render(window)
window.setpos(line, column)
images
.zip(images.lazy.map(&:height).scan(line, :+))
.each { |r, l| r.at(l, column).render(window) }
self
end
|
#to_s ⇒ Object
30
31
32
|
# File 'lib/twterm/image/vertical_sequential_image.rb', line 30
def to_s
images.map(&:to_s).join("\n")
end
|
#width ⇒ Object
34
35
36
|
# File 'lib/twterm/image/vertical_sequential_image.rb', line 34
def width
images.map(&:width).max
end
|
#|(other) ⇒ Object
8
9
10
|
# File 'lib/twterm/image/vertical_sequential_image.rb', line 8
def |(other)
append(other)
end
|