7
7
[ hound-badge ] : https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg
8
8
[ hound ] : https://houndci.com
9
9
10
- SuperDiff is a tool that displays the differences between two data structures of
11
- any type in Ruby.
10
+ SuperDiff is a Ruby gem that intelligently displays the differences between two
11
+ data structures of any type.
12
+
13
+ 📢 ** [ See what's changed in the latest version (0.1.0)] [ changelog ] .**
14
+
15
+ [ changelog ] : CHANGELOG.md
12
16
13
17
## Introduction
14
18
@@ -17,8 +21,8 @@ capabilities. Sometimes, whenever you use a matcher such as `eq`, `match`,
17
21
` include ` , or ` have_attributes ` , you will get a diff of the two data structures
18
22
you are trying to match against. This is really helpful for strings, but not so
19
23
helpful for other, more "real world" kinds of values, such as arrays, hashes,
20
- and full-scale objects. The reason this doesn't work is because [ RSpec will
21
- naively run your ` expected ` and ` actual ` values through Ruby's PrettyPrinter
24
+ and full-scale objects. The reason this doesn't work is because [ all RSpec does
25
+ is run your ` expected ` and ` actual ` values through Ruby's PrettyPrinter
22
26
library] [ rspec-differ-fail ] and then perform a diff of these strings.
23
27
24
28
For instance, let's say you wanted to compare these two hashes:
@@ -77,9 +81,9 @@ You would get output that looks like:
77
81
78
82
Not great.
79
83
80
- This library provides a sophisticated set of comparators that know how to
81
- intelligent compute the differences between two data structures and display them
82
- in a way that makes sense. Using the example above, you'd get this instead:
84
+ This library provides a diff engine that knows how to figure out the differences
85
+ between any two data structures and display them in a sensible way. Using the
86
+ example above, you'd get this instead:
83
87
84
88
![ After super_diff] ( doc/after_super_diff.png )
85
89
@@ -131,9 +135,9 @@ your test helper file (either `rails_helper` or `spec_helper`):
131
135
132
136
``` ruby
133
137
SuperDiff ::RSpec .configure do |config |
134
- config.extra_differ_classes << YourDiffer
135
- config.extra_operational_sequencer_classes << YourOperationalSequencer
136
- config.extra_diff_formatter_classes << YourDiffFormatter
138
+ config.add_extra_differ_class( YourDiffer )
139
+ config.add_extra_operational_sequencer_class( YourOperationalSequencer )
140
+ config.add_extra_diff_formatter_class( YourDiffFormatter )
137
141
end
138
142
```
139
143
@@ -143,16 +147,17 @@ and diff formatter. Also explanations on what these are.)*
143
147
## Contributing
144
148
145
149
If you encounter a bug or have an idea for how this could be better, feel free
146
- to create an issue.
150
+ to [ create an issue] ( https://github.com/mcmire/super_diff/issues ) .
147
151
148
152
If you'd like to submit a PR instead, here's how to get started. First, fork
149
- this repo and then run:
153
+ this repo. Then, when you've cloned your fork, run:
150
154
151
155
```
152
156
bundle install
153
157
```
154
158
155
- This will install dependencies. From here you can run all of the tests:
159
+ This will install various dependencies. After this, you can run all of the
160
+ tests:
156
161
157
162
```
158
163
bundle exec rake
@@ -188,7 +193,7 @@ Thank you so much!
188
193
189
194
[ original-version ] : https://github.com/mcmire/super_diff/tree/old-master
190
195
[ diff-lcs ] : https://github.com/halostatue/diff-lcs
191
- [ pretty-printer ] : https://github.com/ruby/ruby/tree/master/lib
196
+ [ pretty-printer ] : https://github.com/ruby/ruby/tree/master/lib/prettyprint.rb
192
197
[ awesome-print ] : https://github.com/awesome-print/awesome_print
193
198
[ inspection-tree ] : https://github.com/mcmire/super_diff/blob/master/lib/super_diff/object_inspection/inspection_tree.rb
194
199
0 commit comments