Module: Sai::Decorator::NamedStyles Abstract Private

Included in:
Sai::Decorator
Defined in:
lib/sai/decorator/named_styles.rb

Overview

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

This module is abstract.

This module is meant to be included in the Sai::Decorator class to provide named style methods

Named style methods for the Sai::Decorator class

Author:

Since:

  • 0.3.1

Instance Method Summary collapse

Instance Method Details

Apply the ANSI style "blink" to the text

Examples:

decorator.blink.decorate('Hello, world!').to_s #=> "\e[5mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#bold ⇒ Decorator

Apply the ANSI style "bold" to the text

Examples:

decorator.bold.decorate('Hello, world!').to_s #=> "\e[1mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#conceal ⇒ Decorator

Apply the ANSI style "conceal" to the text

Examples:

decorator.conceal.decorate('Hello, world!').to_s #=> "\e[8mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#dim ⇒ Decorator

Apply the ANSI style "dim" to the text

Examples:

decorator.dim.decorate('Hello, world!').to_s #=> "\e[2mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#italic ⇒ Decorator

Apply the ANSI style "italic" to the text

Examples:

decorator.italic.decorate('Hello, world!').to_s #=> "\e[3mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

Remove the ANSI style "blink" from the text

Examples:

decorator.no_blink.decorate('Hello, world!').to_s #=> "\e[25mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#no_conceal ⇒ Decorator

Remove the ANSI style "conceal" from the text

Examples:

decorator.no_conceal.decorate('Hello, world!').to_s #=> "\e[28mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#no_italic ⇒ Decorator

Remove the ANSI style "italic" from the text

Examples:

decorator.no_italic.decorate('Hello, world!').to_s #=> "\e[23mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#no_reverse ⇒ Decorator

Remove the ANSI style "reverse" from the text

Examples:

decorator.no_reverse.decorate('Hello, world!').to_s #=> "\e[27mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#no_strike ⇒ Decorator

Remove the ANSI style "strike" from the text

Examples:

decorator.no_strike.decorate('Hello, world!').to_s #=> "\e[29mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#no_underline ⇒ Decorator

Remove the ANSI style "underline" from the text

Examples:

decorator.no_underline.decorate('Hello, world!').to_s #=> "\e[24mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#normal_intensity ⇒ Decorator

Remove any intensity styles (bold or dim) from the text

Examples:

decorator.normal_intensity.decorate('Hello, world!').to_s #=> "\e[22mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

Apply the ANSI style "rapid_blink" to the text

Examples:

decorator.rapid_blink.decorate('Hello, world!').to_s #=> "\e[6mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#reverse ⇒ Decorator

Apply the ANSI style "reverse" to the text

Examples:

decorator.reverse.decorate('Hello, world!').to_s #=> "\e[7mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#strike ⇒ Decorator

Apply the ANSI style "strike" to the text

Examples:

decorator.strike.decorate('Hello, world!').to_s #=> "\e[9mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end

#underline ⇒ Decorator

Apply the ANSI style "underline" to the text

Examples:

decorator.underline.decorate('Hello, world!').to_s #=> "\e[4mHello, world!\e[0m"

Returns:

  • (Decorator) —

    a new instance of Decorator with the style applied

Author:

Since:

  • 0.1.0



238
239
240
241
242
# File 'lib/sai/decorator/named_styles.rb', line 238

ANSI::STYLES.each_key do |style|
  define_method(style) do
    apply_style(style)
  end
end