Class: DeeperHash::ColorDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/deeper_hash/color_diff.rb

Constant Summary collapse

INDENT_SIZE =
2

Instance Method Summary collapse

Constructor Details

#initialize(h1, h2) ⇒ ColorDiff

Returns a new instance of ColorDiff.



8
9
10
# File 'lib/deeper_hash/color_diff.rb', line 8

def initialize(h1, h2)
  @diff = Diff.new(h1, h2).diff
end

Instance Method Details

#draw(color_opts = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/deeper_hash/color_diff.rb', line 12

def draw(color_opts = {})
  @color_opts = {
    added: { fg: :gui114 },
    removed: { fg: :gui161 },
    changed: { fg: :gui105 },
    content: { fg: :gui241 }
  }.merge(color_opts)
  @use_indent = true
  @indent = 0
  @result_str = ""
  draw_hash_diff(@diff)
  @indent = 0
  @result_str
end