Module: Vedeu::EscapeSequences::Esc

Extended by:
Esc
Includes:
Common, Actions, Background, Borders, Colours, Foreground, Mouse
Included in:
Esc
Defined in:
lib/vedeu/esc/esc.rb

Overview

Provides escape sequence strings for setting the cursor position and various display related functions.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.absent?(variable) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether a variable is nil or empty.

Parameters:

  • variable (String|Symbol|Array|Fixnum)

    The variable to check.

Returns:

.background_codesHash<Symbol => Fixnum> Originally defined in module Colours

Produces the background named colour escape sequence hash from the foreground escape sequence hash.

Returns:

  • (Hash<Symbol => Fixnum>)

.background_colour(named_colour, &block) ⇒ String Originally defined in module Colours

Parameters:

  • named_colour (Symbol)
  • block (Proc)

Returns:

  • (String)

.become(klass, attributes) ⇒ Class Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Converts one class into another.

Parameters:

  • klass (Class)

    The class to become an instance of.

  • attributes (Hash)

    The attributes of klass.

Returns:

  • (Class)

    Returns a new instance of klass.

.bg_resetString Originally defined in module Actions

Returns:

  • (String)

.black(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

Returns:

  • (String)

Returns:

  • (String)

.blue(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.boldString Originally defined in module Actions

Returns:

  • (String)

.bold_offString Originally defined in module Actions

Returns:

  • (String)

.boolean(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating the value was a boolean.

Parameters:

  • value (void)

Returns:

.boolean?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value is a Boolean.

Parameters:

Returns:

.border(&block) ⇒ String

Return the escape sequence to render a border character.

Parameters:

  • block (Proc)

Yield Returns:

  • (void)

    The border character to wrap with border on and off escape sequences.

Returns:

  • (String)


60
61
62
63
64
# File 'lib/vedeu/esc/esc.rb', line 60

def border(&block)
  return '' unless block_given?

  border_on + yield + border_off
end

.border_offString Originally defined in module Borders

Returns:

  • (String)

.border_onString Originally defined in module Borders

Returns:

  • (String)

.bottom_leftString Originally defined in module Borders

└ # u2514

Returns:

  • (String)

.bottom_rightString Originally defined in module Borders

Produces ‘┘’ (u2518)

Returns:

  • (String)

.clearString

Returns:

  • (String)


67
68
69
# File 'lib/vedeu/esc/esc.rb', line 67

def clear
  "#{colour_reset}\e[2J"
end

.clear_lineString

Returns:

  • (String)


83
84
85
# File 'lib/vedeu/esc/esc.rb', line 83

def clear_line
  "#{colour_reset}\e[2K"
end

.colour(named_colour, &block) ⇒ String Also known as: foreground_colour Originally defined in module Colours

Parameters:

  • named_colour (Symbol)
  • block (Proc)

Returns:

  • (String)

.colour_resetString

Returns:

  • (String)


88
89
90
# File 'lib/vedeu/esc/esc.rb', line 88

def colour_reset
  Vedeu::Colours::Colour.coerce(Vedeu.config.colour).to_s
end

.cursor_positionString Originally defined in module Actions

Returns:

  • (String)

.cyan(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.dark_grey(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.default(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.dimString Originally defined in module Actions

Returns:

  • (String)

.disable_mouseString Originally defined in module Mouse

Returns:

  • (String)

.enable_mouseString Originally defined in module Mouse

Returns:

  • (String)

.escVedeu::EscapeSequences::Esc



22
23
24
# File 'lib/vedeu/esc/esc.rb', line 22

def esc
  self
end

.escape(stream = '') ⇒ String

Return the stream with the escape sequences escaped so that they can be printed to the terminal instead of being interpreted by the terminal which will render them. This way we can see what escape sequences are being sent along with the content.

Parameters:

  • stream (String) (defaults to: '')

Returns:

  • (String)


34
35
36
37
38
# File 'lib/vedeu/esc/esc.rb', line 34

def escape(stream = '')
  return stream if absent?(stream)

  stream.gsub(/\e/, '\\e')
end

.escape?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value is an escape sequence object (e.g. Vedeu::Cells::Escape.)

Returns:

.falsy?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value should be considered false.

Parameters:

  • value (void)

Returns:

.fg_resetString Originally defined in module Actions

Returns:

  • (String)

.foreground_codesHash<Symbol => Fixnum> Originally defined in module Colours

Produces the foreground named colour escape sequence hash. The background escape sequences are also generated from this by adding 10 to the values. This hash gives rise to methods you can call directly on ‘Esc` to produce the desired colours:

Examples:

# "\e[31m"
Vedeu::EscapeSequences::Esc.red

# "\e[31msome text\e[39m"
Vedeu::EscapeSequences::Esc.red { 'some text' }

# "\e[44m"
Vedeu::EscapeSequences::Esc.on_blue

# "\e[44msome text\e[49m"
Vedeu::EscapeSequences::Esc.on_blue { 'some text' }

# Valid names:
:black, :red, :green, :yellow, :blue, :magenta, :cyan,
:light_grey, :default, :dark_grey, :light_red, :light_green,
:light_yellow, :light_blue, :light_magenta, :light_cyan,
:white

Returns:

  • (Hash<Symbol => Fixnum>)

.green(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.hash?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value is a Hash.

Parameters:

  • value (Hash|void)

Returns:

.hide_cursorString Originally defined in module Actions

Returns:

  • (String)

.horizontalString Originally defined in module Borders

Produces ‘─’ (u2500)

Returns:

  • (String)

.horizontal_bottomString Originally defined in module Borders

Produces ‘┴’ (u2534)

Returns:

  • (String)

.horizontal_topString Originally defined in module Borders

Produces ‘┬’ (u252C)

Returns:

  • (String)

.last_character_positionString

Returns:

  • (String)


103
104
105
# File 'lib/vedeu/esc/esc.rb', line 103

def last_character_position
  Vedeu::Geometries::Position.coerce([Vedeu.height, Vedeu.width]).to_s
end

.light_blue(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.light_cyan(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.light_green(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.light_grey(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.light_magenta(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.light_red(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.light_yellow(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.line_model?Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating the model is a Views::Line.

Returns:

.magenta(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.mouse_offString Originally defined in module Mouse

Returns:

  • (String)

.mouse_onString Originally defined in module Mouse

Returns:

  • (String)

.mouse_x10_offString Originally defined in module Mouse

Returns:

  • (String)

.mouse_x10_onString Originally defined in module Mouse

Returns:

  • (String)

.negativeString Originally defined in module Actions

Returns:

  • (String)

.normalString

Returns:

  • (String)


93
94
95
# File 'lib/vedeu/esc/esc.rb', line 93

def normal
  "#{underline_off}#{bold_off}#{positive}"
end

.numeric?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value is a Fixnum.

Parameters:

  • value (Fixnum|void)

Returns:

.on_black(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_blue(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_cyan(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_dark_grey(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_default(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_green(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_light_blue(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_light_cyan(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_light_green(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_light_grey(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_light_magenta(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_light_red(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_light_yellow(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_magenta(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_red(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_white(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.on_yellow(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

.positiveString Originally defined in module Actions

Returns:

  • (String)

.present?(variable) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether a variable has a useful value.

Parameters:

  • variable (String|Symbol|Array|Fixnum)

    The variable to check.

Returns:

.red(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.resetString Originally defined in module Actions

Returns:

  • (String)

.screen_colour_resetString

Returns:

  • (String)


98
99
100
# File 'lib/vedeu/esc/esc.rb', line 98

def screen_colour_reset
  "#{fg_reset}#{bg_reset}"
end

.screen_exitString

Returns:

  • (String)


77
78
79
80
# File 'lib/vedeu/esc/esc.rb', line 77

def screen_exit
  "#{disable_mouse}#{show_cursor}#{screen_colour_reset}#{reset}" \
  "#{last_character_position}\n"
end

.screen_initString

Returns:

  • (String)


72
73
74
# File 'lib/vedeu/esc/esc.rb', line 72

def screen_init
  "#{reset}#{clear}#{hide_cursor}#{enable_mouse}"
end

.show_cursorString Originally defined in module Actions

Returns:

  • (String)

.snake_case(klass) ⇒ String Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Converts a class name to a lowercase snake case string.

Examples:

snake_case(MyClassName) # => "my_class_name"
snake_case(NameSpaced::ClassName)
# => "name_spaced/class_name"

snake_case('MyClassName') # => "my_class_name"
snake_case(NameSpaced::ClassName)
# => "name_spaced/class_name"

Parameters:

  • klass (Module|Class|String)

Returns:

  • (String)

.stream_model?Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating the model is a Views::Stream.

Returns:

.string(value = '') ⇒ String

Return the escape sequence string from the list of recognised sequence ‘commands’, or an empty string when the ‘command’ cannot be found.

Parameters:

  • value (String|Symbol) (defaults to: '')

Returns:

  • (String)


46
47
48
49
50
51
52
# File 'lib/vedeu/esc/esc.rb', line 46

def string(value = '')
  return '' unless present?(value)

  send(value)
rescue NoMethodError
  ''
end

.string?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value is a Fixnum.

Parameters:

  • value (String|void)

Returns:

.top_leftString Originally defined in module Borders

Produces ‘┌’ (u250C)

Returns:

  • (String)

.top_rightString Originally defined in module Borders

Produces ‘┐’ (u2510)

Returns:

  • (String)

.truthy?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value should be considered true.

Parameters:

  • value (void)

Returns:

.underlineString Originally defined in module Actions

Returns:

  • (String)

.underline_offString Originally defined in module Actions

Returns:

  • (String)

.valid_codesArray<Symbol> Originally defined in module Colours

Returns:

  • (Array<Symbol>)

.valid_name?(named_colour) ⇒ Boolean Originally defined in module Colours

Returns a boolean indicating whether the colour provided is a valid named colour.

Parameters:

  • named_colour (Symbol)

Returns:

.verticalString Originally defined in module Borders

Produces ‘│’ (u2502)

Returns:

  • (String)

.vertical_leftString Originally defined in module Borders

Produces ‘├’ (u251C)

Returns:

  • (String)

.vertical_rightString Originally defined in module Borders

Produces ‘┤’ (u2524)

Returns:

  • (String)

.view_model?Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating the model is a Views::View.

Returns:

.white(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

.yellow(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

Instance Method Details

#absent?(variable) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether a variable is nil or empty.

Parameters:

  • variable (String|Symbol|Array|Fixnum)

    The variable to check.

Returns:

#background_codesHash<Symbol => Fixnum> Originally defined in module Colours

Produces the background named colour escape sequence hash from the foreground escape sequence hash.

Returns:

  • (Hash<Symbol => Fixnum>)

#background_colour(named_colour, &block) ⇒ String Originally defined in module Colours

Parameters:

  • named_colour (Symbol)
  • block (Proc)

Returns:

  • (String)

#become(klass, attributes) ⇒ Class Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Converts one class into another.

Parameters:

  • klass (Class)

    The class to become an instance of.

  • attributes (Hash)

    The attributes of klass.

Returns:

  • (Class)

    Returns a new instance of klass.

#bg_resetString Originally defined in module Actions

Returns:

  • (String)

#black(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

Returns:

  • (String)

Returns:

  • (String)

#blue(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#boldString Originally defined in module Actions

Returns:

  • (String)

#bold_offString Originally defined in module Actions

Returns:

  • (String)

#boolean(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating the value was a boolean.

Parameters:

  • value (void)

Returns:

#boolean?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value is a Boolean.

Parameters:

Returns:

#border(&block) ⇒ String

Return the escape sequence to render a border character.

Parameters:

  • block (Proc)

Yield Returns:

  • (void)

    The border character to wrap with border on and off escape sequences.

Returns:

  • (String)


60
61
62
63
64
# File 'lib/vedeu/esc/esc.rb', line 60

def border(&block)
  return '' unless block_given?

  border_on + yield + border_off
end

#border_offString Originally defined in module Borders

Returns:

  • (String)

#border_onString Originally defined in module Borders

Returns:

  • (String)

#bottom_leftString Originally defined in module Borders

└ # u2514

Returns:

  • (String)

#bottom_rightString Originally defined in module Borders

Produces ‘┘’ (u2518)

Returns:

  • (String)

#clearString

Returns:

  • (String)


67
68
69
# File 'lib/vedeu/esc/esc.rb', line 67

def clear
  "#{colour_reset}\e[2J"
end

#clear_lineString

Returns:

  • (String)


83
84
85
# File 'lib/vedeu/esc/esc.rb', line 83

def clear_line
  "#{colour_reset}\e[2K"
end

#colour(named_colour, &block) ⇒ String Also known as: foreground_colour Originally defined in module Colours

Parameters:

  • named_colour (Symbol)
  • block (Proc)

Returns:

  • (String)

#colour_resetString

Returns:

  • (String)


88
89
90
# File 'lib/vedeu/esc/esc.rb', line 88

def colour_reset
  Vedeu::Colours::Colour.coerce(Vedeu.config.colour).to_s
end

#cursor_positionString Originally defined in module Actions

Returns:

  • (String)

#cyan(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#dark_grey(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#default(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#dimString Originally defined in module Actions

Returns:

  • (String)

#disable_mouseString Originally defined in module Mouse

Returns:

  • (String)

#enable_mouseString Originally defined in module Mouse

Returns:

  • (String)

#escVedeu::EscapeSequences::Esc



22
23
24
# File 'lib/vedeu/esc/esc.rb', line 22

def esc
  self
end

#escape(stream = '') ⇒ String

Return the stream with the escape sequences escaped so that they can be printed to the terminal instead of being interpreted by the terminal which will render them. This way we can see what escape sequences are being sent along with the content.

Parameters:

  • stream (String) (defaults to: '')

Returns:

  • (String)


34
35
36
37
38
# File 'lib/vedeu/esc/esc.rb', line 34

def escape(stream = '')
  return stream if absent?(stream)

  stream.gsub(/\e/, '\\e')
end

#escape?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value is an escape sequence object (e.g. Vedeu::Cells::Escape.)

Returns:

#falsy?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value should be considered false.

Parameters:

  • value (void)

Returns:

#fg_resetString Originally defined in module Actions

Returns:

  • (String)

#foreground_codesHash<Symbol => Fixnum> Originally defined in module Colours

Produces the foreground named colour escape sequence hash. The background escape sequences are also generated from this by adding 10 to the values. This hash gives rise to methods you can call directly on ‘Esc` to produce the desired colours:

Examples:

# "\e[31m"
Vedeu::EscapeSequences::Esc.red

# "\e[31msome text\e[39m"
Vedeu::EscapeSequences::Esc.red { 'some text' }

# "\e[44m"
Vedeu::EscapeSequences::Esc.on_blue

# "\e[44msome text\e[49m"
Vedeu::EscapeSequences::Esc.on_blue { 'some text' }

# Valid names:
:black, :red, :green, :yellow, :blue, :magenta, :cyan,
:light_grey, :default, :dark_grey, :light_red, :light_green,
:light_yellow, :light_blue, :light_magenta, :light_cyan,
:white

Returns:

  • (Hash<Symbol => Fixnum>)

#green(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#hash?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value is a Hash.

Parameters:

  • value (Hash|void)

Returns:

#hide_cursorString Originally defined in module Actions

Returns:

  • (String)

#horizontalString Originally defined in module Borders

Produces ‘─’ (u2500)

Returns:

  • (String)

#horizontal_bottomString Originally defined in module Borders

Produces ‘┴’ (u2534)

Returns:

  • (String)

#horizontal_topString Originally defined in module Borders

Produces ‘┬’ (u252C)

Returns:

  • (String)

#last_character_positionString

Returns:

  • (String)


103
104
105
# File 'lib/vedeu/esc/esc.rb', line 103

def last_character_position
  Vedeu::Geometries::Position.coerce([Vedeu.height, Vedeu.width]).to_s
end

#light_blue(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#light_cyan(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#light_green(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#light_grey(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#light_magenta(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#light_red(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#light_yellow(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#line_model?Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating the model is a Views::Line.

Returns:

#magenta(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#mouse_offString Originally defined in module Mouse

Returns:

  • (String)

#mouse_onString Originally defined in module Mouse

Returns:

  • (String)

#mouse_x10_offString Originally defined in module Mouse

Returns:

  • (String)

#mouse_x10_onString Originally defined in module Mouse

Returns:

  • (String)

#negativeString Originally defined in module Actions

Returns:

  • (String)

#normalString

Returns:

  • (String)


93
94
95
# File 'lib/vedeu/esc/esc.rb', line 93

def normal
  "#{underline_off}#{bold_off}#{positive}"
end

#numeric?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value is a Fixnum.

Parameters:

  • value (Fixnum|void)

Returns:

#on_black(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_blue(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_cyan(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_dark_grey(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_default(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_green(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_light_blue(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_light_cyan(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_light_green(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_light_grey(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_light_magenta(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_light_red(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_light_yellow(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_magenta(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_red(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_white(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#on_yellow(&block) ⇒ String Originally defined in module Background

Parameters:

  • block (Proc)

Returns:

  • (String)

#positiveString Originally defined in module Actions

Returns:

  • (String)

#present?(variable) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether a variable has a useful value.

Parameters:

  • variable (String|Symbol|Array|Fixnum)

    The variable to check.

Returns:

#red(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#resetString Originally defined in module Actions

Returns:

  • (String)

#screen_colour_resetString

Returns:

  • (String)


98
99
100
# File 'lib/vedeu/esc/esc.rb', line 98

def screen_colour_reset
  "#{fg_reset}#{bg_reset}"
end

#screen_exitString

Returns:

  • (String)


77
78
79
80
# File 'lib/vedeu/esc/esc.rb', line 77

def screen_exit
  "#{disable_mouse}#{show_cursor}#{screen_colour_reset}#{reset}" \
  "#{last_character_position}\n"
end

#screen_initString

Returns:

  • (String)


72
73
74
# File 'lib/vedeu/esc/esc.rb', line 72

def screen_init
  "#{reset}#{clear}#{hide_cursor}#{enable_mouse}"
end

#show_cursorString Originally defined in module Actions

Returns:

  • (String)

#snake_case(klass) ⇒ String Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Converts a class name to a lowercase snake case string.

Examples:

snake_case(MyClassName) # => "my_class_name"
snake_case(NameSpaced::ClassName)
# => "name_spaced/class_name"

snake_case('MyClassName') # => "my_class_name"
snake_case(NameSpaced::ClassName)
# => "name_spaced/class_name"

Parameters:

  • klass (Module|Class|String)

Returns:

  • (String)

#stream_model?Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating the model is a Views::Stream.

Returns:

#string(value = '') ⇒ String

Return the escape sequence string from the list of recognised sequence ‘commands’, or an empty string when the ‘command’ cannot be found.

Parameters:

  • value (String|Symbol) (defaults to: '')

Returns:

  • (String)


46
47
48
49
50
51
52
# File 'lib/vedeu/esc/esc.rb', line 46

def string(value = '')
  return '' unless present?(value)

  send(value)
rescue NoMethodError
  ''
end

#string?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value is a Fixnum.

Parameters:

  • value (String|void)

Returns:

#top_leftString Originally defined in module Borders

Produces ‘┌’ (u250C)

Returns:

  • (String)

#top_rightString Originally defined in module Borders

Produces ‘┐’ (u2510)

Returns:

  • (String)

#truthy?(value) ⇒ Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating whether the value should be considered true.

Parameters:

  • value (void)

Returns:

#underlineString Originally defined in module Actions

Returns:

  • (String)

#underline_offString Originally defined in module Actions

Returns:

  • (String)

#valid_codesArray<Symbol> Originally defined in module Colours

Returns:

  • (Array<Symbol>)

#valid_name?(named_colour) ⇒ Boolean Originally defined in module Colours

Returns a boolean indicating whether the colour provided is a valid named colour.

Parameters:

  • named_colour (Symbol)

Returns:

#verticalString Originally defined in module Borders

Produces ‘│’ (u2502)

Returns:

  • (String)

#vertical_leftString Originally defined in module Borders

Produces ‘├’ (u251C)

Returns:

  • (String)

#vertical_rightString Originally defined in module Borders

Produces ‘┤’ (u2524)

Returns:

  • (String)

#view_model?Boolean Originally defined in module Common

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a boolean indicating the model is a Views::View.

Returns:

#white(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)

#yellow(&block) ⇒ String Originally defined in module Foreground

Parameters:

  • block (Proc)

Returns:

  • (String)