Class: DiffJson::Diff
- Inherits:
-
Object
- Object
- DiffJson::Diff
- Defined in:
- lib/diff_json/diff.rb
Instance Method Summary collapse
- #diff ⇒ Object
-
#initialize(old_json, new_json, **opts) ⇒ Diff
constructor
A new instance of Diff.
- #retrieve_output(output_type = :stdout, **output_opts) ⇒ Object
Constructor Details
#initialize(old_json, new_json, **opts) ⇒ Diff
Returns a new instance of Diff.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/diff_json/diff.rb', line 3 def initialize(old_json, new_json, **opts) @old_json = old_json @new_json = new_json @opts = { :debug => false, :ignore_object_keys => [], :diff_count_filter => { :only => ['$**'], :except => [] } }.merge(opts) @filtered = @opts[:diff_count_filter] != { :only => ['$**'], :except => [] } @diff = { :count => { :all => 0, :insert => 0, :update => 0, :delete => 0, :move => 0 }, :old => [], :new => [] } calculate end |
Instance Method Details
#diff ⇒ Object
33 34 35 |
# File 'lib/diff_json/diff.rb', line 33 def diff return @diff end |
#retrieve_output(output_type = :stdout, **output_opts) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/diff_json/diff.rb', line 37 def retrieve_output(output_type = :stdout, **output_opts) case output_type when :stdout when :file when :html html_output = HtmlOutput.new(@diff, **output_opts) return html_output end end |