Class: Hexdump::Theme

Inherits:
Object
  • Object
show all
Defined in:
lib/hexdump/theme.rb,
lib/hexdump/theme/ansi.rb,
lib/hexdump/theme/rule.rb

Overview

Represents a hexdump theme (styling + highlighting).

Since:

  • 1.0.0

Defined Under Namespace

Classes: ANSI, Rule

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(style: {}, highlights: {}) ⇒ Theme

Initializes the theme.

Parameters:

  • style (Hash{:index,:numeric,:chars => Symbol,Array<Symbol>,nil}) (defaults to: {})

    The default style of the index, numeric, and/or chars columns.

  • highlights (Hash{:index,:numeric,:chars => Hash{String,Regexp => Symbol,Array<Symbol>},nil}) (defaults to: {})

    The highlighting rules for the index, numeric, and/or chars columns.

Since:

  • 1.0.0



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/hexdump/theme.rb', line 43

def initialize(style: {}, highlights: {})
  @index   = Rule.new(
               style:      style[:index],
               highlights: highlights[:index]
             )

  @numeric = Rule.new(
               style:      style[:numeric],
               highlights: highlights[:numeric]
             )

  @chars   = Rule.new(
               style:      style[:chars],
               highlights: highlights[:chars]
            )
end

Instance Attribute Details

#charsRule? (readonly)

The chars styling/highlights.

Returns:

Since:

  • 1.0.0



32
33
34
# File 'lib/hexdump/theme.rb', line 32

def chars
  @chars
end

#indexRule? (readonly)

The index styling/highlights.

Returns:

Since:

  • 1.0.0



18
19
20
# File 'lib/hexdump/theme.rb', line 18

def index
  @index
end

#numericRule? (readonly)

The numeric styling/highlights.

Returns:

Since:

  • 1.0.0



25
26
27
# File 'lib/hexdump/theme.rb', line 25

def numeric
  @numeric
end