Class: AsciinemaWin::AnsiParser::StyledChar

Inherits:
Data
  • Object
show all
Defined in:
lib/asciinema_win/ansi_parser.rb

Overview

Character with style information

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bgObject (readonly)

Returns the value of attribute bg

Returns:

  • (Object)

    the current value of bg



10
11
12
# File 'lib/asciinema_win/ansi_parser.rb', line 10

def bg
  @bg
end

#boldObject (readonly)

Returns the value of attribute bold

Returns:

  • (Object)

    the current value of bold



10
11
12
# File 'lib/asciinema_win/ansi_parser.rb', line 10

def bold
  @bold
end

#charObject (readonly)

Returns the value of attribute char

Returns:

  • (Object)

    the current value of char



10
11
12
# File 'lib/asciinema_win/ansi_parser.rb', line 10

def char
  @char
end

#fgObject (readonly)

Returns the value of attribute fg

Returns:

  • (Object)

    the current value of fg



10
11
12
# File 'lib/asciinema_win/ansi_parser.rb', line 10

def fg
  @fg
end

#italicObject (readonly)

Returns the value of attribute italic

Returns:

  • (Object)

    the current value of italic



10
11
12
# File 'lib/asciinema_win/ansi_parser.rb', line 10

def italic
  @italic
end

#strikethroughObject (readonly)

Returns the value of attribute strikethrough

Returns:

  • (Object)

    the current value of strikethrough



10
11
12
# File 'lib/asciinema_win/ansi_parser.rb', line 10

def strikethrough
  @strikethrough
end

#underlineObject (readonly)

Returns the value of attribute underline

Returns:

  • (Object)

    the current value of underline



10
11
12
# File 'lib/asciinema_win/ansi_parser.rb', line 10

def underline
  @underline
end

Instance Method Details

#default_style?Boolean

Check if this character has default styling

Returns:

  • (Boolean)

    True if no special styling applied



14
15
16
# File 'lib/asciinema_win/ansi_parser.rb', line 14

def default_style?
  fg.nil? && bg.nil? && !bold && !italic && !underline && !strikethrough
end

#same_style?(other) ⇒ Boolean

Check if style matches another character

Parameters:

  • other (StyledChar)

    Other character to compare

Returns:

  • (Boolean)

    True if styles match



22
23
24
25
26
27
28
29
# File 'lib/asciinema_win/ansi_parser.rb', line 22

def same_style?(other)
  fg == other.fg &&
    bg == other.bg &&
    bold == other.bold &&
    italic == other.italic &&
    underline == other.underline &&
    strikethrough == other.strikethrough
end