Class: Twterm::Image::StringImage
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 StringImage.
4
5
6
|
# File 'lib/twterm/image/string_image.rb', line 4
def initialize(string)
@string = string
end
|
Instance Method Details
#-(other) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/twterm/image/string_image.rb', line 8
def -(other)
if other.is_a?(self.class)
self.class.new(string + other.string)
else
super
end
end
|
#height ⇒ Object
16
17
18
|
# File 'lib/twterm/image/string_image.rb', line 16
def height
1
end
|
#render(window) ⇒ Object
20
21
22
23
|
# File 'lib/twterm/image/string_image.rb', line 20
def render(window)
window.setpos(line, column)
window.addstr(string)
end
|
#to_s ⇒ Object
25
26
27
|
# File 'lib/twterm/image/string_image.rb', line 25
def to_s
@string.dup
end
|
#width ⇒ Object
29
30
31
|
# File 'lib/twterm/image/string_image.rb', line 29
def width
string.width
end
|