Class: Twterm::Image::Between
Instance Method Summary
collapse
#!, #-, #_, #at, blank_line, #bold, #brackets, checkbox, #color, #column, cursor, #dim, empty, #line, number, #parens, plural, remaining_resource, string, toggle_switch, #underlined, whitespace, #|
Constructor Details
#initialize(image, open, close) ⇒ Between
Returns a new instance of Between.
3
4
5
|
# File 'lib/twterm/image/between.rb', line 3
def initialize(image, open, close)
@image, @open, @close = image, open, close
end
|
Instance Method Details
#height ⇒ Object
7
8
9
|
# File 'lib/twterm/image/between.rb', line 7
def height
1
end
|
#render(window) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/twterm/image/between.rb', line 11
def render(window)
open.at(line, column).render(window)
image.at(line, column + open.width).render(window)
close.at(line, column + open.width + image.width).render(window)
self
end
|
#to_s ⇒ Object
19
20
21
|
# File 'lib/twterm/image/between.rb', line 19
def to_s
"#{open}#{image}#{close}"
end
|
#width ⇒ Object
23
24
25
|
# File 'lib/twterm/image/between.rb', line 23
def width
[open, image, close].map(&:width).reduce(0, :+)
end
|