Class: RuboCop::Schema::Diff

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/rubocop/schema/diff.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#boolean, #deep_dup, #deep_merge, #http_get, #strip_html, #template, templates

Class Method Details

.apply(old, diff) ⇒ Object



17
18
19
# File 'lib/rubocop/schema/diff.rb', line 17

def apply(old, diff)
  instance.apply old, diff
end

.diff(old, new) ⇒ Object



13
14
15
# File 'lib/rubocop/schema/diff.rb', line 13

def diff(old, new)
  instance.diff old, new
end

.instanceObject



9
10
11
# File 'lib/rubocop/schema/diff.rb', line 9

def instance
  @instance ||= new
end

Instance Method Details

#apply(old, diff) ⇒ Object



28
29
30
31
32
# File 'lib/rubocop/schema/diff.rb', line 28

def apply(old, diff)
  return apply_hash(old, diff) if old.is_a?(Hash) && diff.is_a?(Hash)

  diff
end

#diff(old, new) ⇒ Object



22
23
24
25
26
# File 'lib/rubocop/schema/diff.rb', line 22

def diff(old, new)
  return diff_hashes old, new if old.is_a?(Hash) && new.is_a?(Hash)

  new
end