Added usage examples of collection.to_hash and .to_json
As per @aaronpk wanting this feature to the point of considering creating a separate parser — turns out it is possible, just a little buried!
This commit is contained in:
parent
0734bc5c44
commit
96ed937040
1 changed files with 6 additions and 0 deletions
|
@ -78,6 +78,12 @@ collection = Microformats2.parse(source)
|
|||
collection.entry.name.to_s #=> "Microformats 2"
|
||||
# accessing nested microformats
|
||||
collection.entry.author.format.name.to_s #=> "Jessica Lynn Suttles"
|
||||
|
||||
# getting a copy of the canonical microformats2 hash structure
|
||||
collection.to_hash
|
||||
|
||||
# the above, as JSON in a string
|
||||
collection.to_json
|
||||
```
|
||||
|
||||
* `source` can be a URL, filepath, or HTML
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue