Skip to content

Commit 12d9859

Browse files
committed
Update intro demo
1 parent e0ee30c commit 12d9859

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

README.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -67,38 +67,42 @@ Universal ID introduces a paradigm shift and enables straightforward simple [**s
6767

6868
## URI::UID
6969

70-
Universal ID introduces a new URI defintion that can represent any Ruby object, yet its API is simple.
71-
UID strings are URL-safe and can be reliably transported over the wire using HTTP.
72-
The payload is optimized to be as small as possible... _especially notable with large objects._
70+
Universal ID introduces a new URI defintion that can recursively marshal any Ruby object into an URL-safe string
71+
that can be safely transported over the wire with HTTP.
72+
73+
> [!NOTE]
74+
> The payload is optimized to be as small as possible, _which is especially notable with large objects._
75+
76+
The best part: **The API is simple.**
7377

7478
```ruby
75-
data = { name: "Universal ID Demo", data: { message: "This is cool." } }
79+
data = :ANY_OBJECT_YOU_CAN_IMAGINE
7680

7781
uid = URI::UID.build(data)
78-
#<URI::UID payload=ixuAgtYAbmFtZbFVbml2ZXJzYWwgSUQgRGVtb..., fingerprint=CwSAkccFf6RIYXNoAw>
82+
#<URI::UID payload=Cw6AxxoAQU5ZX09CSkVDVF9ZT1VfQ0FOX0lNQ..., fingerprint=CwWAkccHf6ZTeW1ib2wD>
7983

8084
uid.payload
81-
"ixuAgtYAbmFtZbFVbml2ZXJzYWwgSUQgRGVtb9YAZGF0YYHHBwBtZXNzYWdlrVRoaXMgaXMgY29vbC4D"
85+
"Cw6AxxoAQU5ZX09CSkVDVF9ZT1VfQ0FOX0lNQUdJTkUD"
8286

8387
uid.fingerprint
84-
"CwSAkccFf6RIYXNoAw"
88+
"CwWAkccHf6ZTeW1ib2wD"
8589

8690
uri = uid.to_s
87-
"uid://universalid/ixuAgtYAbmFtZbFVbml2ZXJzYWwgSUQgRGVtb9YAZGF0YYHHBwBtZXNzYWdlrVRoaXMgaXMgY29vbC4D#CwSAkccFf6RIYXNoAw"
91+
"uid://universalid/Cw6AxxoAQU5ZX09CSkVDVF9ZT1VfQ0FOX0lNQUdJTkUD#CwWAkccHf6ZTeW1ib2wD"
8892

8993
parsed = URI::UID.parse(uri)
90-
#<URI::UID payload=ixuAgtYAbmFtZbFVbml2ZXJzYWwgSUQgRGVtb..., fingerprint=CwSAkccFf6RIYXNoAw>
94+
#<URI::UID payload=Cw6AxxoAQU5ZX09CSkVDVF9ZT1VfQ0FOX0lNQ..., fingerprint=CwWAkccHf6ZTeW1ib2wD>
9195

9296
parsed.decode
93-
{:name=>"Universal ID Demo", :data=>{:message=>"This is cool."}}
97+
:ANY_OBJECT_YOU_CAN_IMAGINE
9498

9599
# it's also possible to parse the payload by itself
96100

97101
parsed = URI::UID.from_payload(uid.payload)
98-
#<URI::UID payload=ixuAgtYAbmFtZbFVbml2ZXJzYWwgSUQgRGVtb..., fingerprint=CwSAkccFf6RIYXNoAw>
102+
#<URI::UID payload=Cw6AxxoAQU5ZX09CSkVDVF9ZT1VfQ0FOX0lNQ..., fingerprint=CwWAkccHf6ZTeW1ib2wD>
99103

100104
parsed.decode
101-
{:name=>"Universal ID Demo", :data=>{:message=>"This is cool."}}
105+
:ANY_OBJECT_YOU_CAN_IMAGINE
102106
```
103107

104108
## Supported Data Types

0 commit comments

Comments
 (0)