Skip to content

Commit 691a8ad

Browse files
committed
Update code examples in README
[ci skip]
1 parent a41f3fa commit 691a8ad

File tree

9 files changed

+150
-2
lines changed

9 files changed

+150
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ expect(actual).to eq(expected)
8484

8585
You would get output that looks like this:
8686

87-
![Before super_diff](doc/before_super_diff.png)
87+
![Before super_diff](doc/before.png)
8888

8989
What this library does is to provide a diff engine that knows how to figure out
9090
the differences between any two data structures and display them in a sensible
9191
way. So, using the example above, you'd get this instead:
9292

93-
![After super_diff](doc/after_super_diff.png)
93+
![After super_diff](doc/after.png)
9494

9595
## Installation
9696

doc/after.png

413 KB
Loading

doc/after.rb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
require "super_diff/rspec"
2+
3+
class Person
4+
attr_accessor :name, :age
5+
6+
def initialize(name:, age:)
7+
@name = name
8+
@age = age
9+
end
10+
end
11+
12+
describe "My test" do
13+
it "does something" do
14+
actual = {
15+
customer: {
16+
person: Person.new(name: "Marty McFly, Jr.", age: 17),
17+
shipping_address: {
18+
line_1: "456 Ponderosa Ct.",
19+
city: "Hill Valley",
20+
state: "CA",
21+
zip: "90382",
22+
},
23+
},
24+
items: [
25+
{
26+
name: "Fender Stratocaster",
27+
cost: 100_000,
28+
options: ["red", "blue", "green"],
29+
},
30+
{ name: "Mattel Hoverboard" },
31+
],
32+
}
33+
34+
expected = {
35+
customer: {
36+
person: Person.new(name: "Marty McFly", age: 17),
37+
shipping_address: {
38+
line_1: "123 Main St.",
39+
city: "Hill Valley",
40+
state: "CA",
41+
zip: "90382",
42+
},
43+
},
44+
items: [
45+
{
46+
name: "Fender Stratocaster",
47+
cost: 100_000,
48+
options: ["red", "blue", "green"],
49+
},
50+
{ name: "Chevy 4x4" },
51+
],
52+
}
53+
54+
expect(actual).to eq(expected)
55+
end
56+
end

doc/after_super_diff.png

-557 KB
Binary file not shown.

doc/before.png

297 KB
Loading

doc/before.rb

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
class Person
2+
attr_accessor :name, :age
3+
4+
def initialize(name:, age:)
5+
@name = name
6+
@age = age
7+
end
8+
end
9+
10+
describe "My test" do
11+
it "does something" do
12+
actual = {
13+
customer: {
14+
person: Person.new(name: "Marty McFly, Jr.", age: 17),
15+
shipping_address: {
16+
line_1: "456 Ponderosa Ct.",
17+
city: "Hill Valley",
18+
state: "CA",
19+
zip: "90382",
20+
},
21+
},
22+
items: [
23+
{
24+
name: "Fender Stratocaster",
25+
cost: 100_000,
26+
options: ["red", "blue", "green"],
27+
},
28+
{ name: "Mattel Hoverboard" },
29+
],
30+
}
31+
32+
expected = {
33+
customer: {
34+
person: Person.new(name: "Marty McFly", age: 17),
35+
shipping_address: {
36+
line_1: "123 Main St.",
37+
city: "Hill Valley",
38+
state: "CA",
39+
zip: "90382",
40+
},
41+
},
42+
items: [
43+
{
44+
name: "Fender Stratocaster",
45+
cost: 100_000,
46+
options: ["red", "blue", "green"],
47+
},
48+
{ name: "Chevy 4x4" },
49+
],
50+
}
51+
52+
expect(actual).to eq(expected)
53+
end
54+
end

doc/before_super_diff.png

-561 KB
Binary file not shown.

doc/carbon-config.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"backgroundColor": "rgba(0, 0, 0, 0)",
3+
"backgroundImage": null,
4+
"backgroundImageSelection": null,
5+
"backgroundMode": "color",
6+
"dropShadow": true,
7+
"dropShadowBlurRadius": "20px",
8+
"dropShadowOffsetY": "5px",
9+
"exportSize": "2x",
10+
"firstLineNumber": 1,
11+
"fontFamily": "Fira Code",
12+
"fontSize": "14px",
13+
"hiddenCharacters": false,
14+
"isVisible": true,
15+
"language": "text",
16+
"lineHeight": "133%",
17+
"lineNumbers": false,
18+
"loading": false,
19+
"paddingHorizontal": "25px",
20+
"paddingVertical": "25px",
21+
"squaredImage": false,
22+
"theme": "seti",
23+
"watermark": false,
24+
"widthAdjustment": true,
25+
"windowControls": true,
26+
"windowTheme": "none"
27+
}

doc/carbon.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Carbon
2+
3+
The screenshots in the README are made with Carbon.
4+
5+
The links to the Carbon snippets are:
6+
7+
* [Before](https://carbon.now.sh/iyP283Mj0nRXt1gfvNh7)
8+
* [After](https://carbon.now.sh/C6J2A8WoDhKuiudIYykl)
9+
10+
Unfortunately you have to manually fill in colors every time you reload the page
11+
:(

0 commit comments

Comments
 (0)