Class: WindowTerminal::ColoredText

Inherits:
Text
  • Object
show all
Defined in:
lib/accu-window.rb

Overview

A subclass of Text for colored window text.

Instance Attribute Summary

Attributes inherited from Text

#orientation, #text, #y

Instance Method Summary collapse

Methods inherited from Text

#get_length, #render_line

Constructor Details

#initialize(orientation, text, y, color = :green) ⇒ ColoredText

Initializes a ColoredText object.



215
216
217
218
219
# File 'lib/accu-window.rb', line 215

def initialize(orientation,text,y,color=:green)
	@color = color
	text = colorize(text)
	super(orientation,text,y)
end

Instance Method Details

#set_text(text) ⇒ Object

Sets text while taking into account colorization.



239
240
241
# File 'lib/accu-window.rb', line 239

def set_text(text)
	super(colorize(text))
end

#to_sObject

Makes to_s return something more meaningful.



245
246
247
# File 'lib/accu-window.rb', line 245

def to_s
	"<ColoredText @orientation=#{@orientation.to_s}, @y=#{@y}, @color=#{@color.to_s} >"
end