class Console::Terminal::XTerm
Constants
- ATTRIBUTES
- COLORS
Public Instance Methods
colors?()
click to toggle source
# File lib/console/terminal/xterm.rb, line 53 def colors? true end
reset()
click to toggle source
# File lib/console/terminal/xterm.rb, line 79 def reset "\e[0m" end
size()
click to toggle source
# File lib/console/terminal/xterm.rb, line 57 def size @output.winsize end
style(foreground, background = nil, *attributes)
click to toggle source
# File lib/console/terminal/xterm.rb, line 61 def style(foreground, background = nil, *attributes) tokens = [] if foreground tokens << 30 + COLORS.fetch(foreground) end if background tokens << 40 + COLORS.fetch(background) end attributes.each do |attribute| tokens << ATTRIBUTES.fetch(attribute){attribute.to_i} end return "\e[#{tokens.join(';')}m" end