Merge pull request #30 from barnabywalters/patch-1
Added usage examples of collection.to_hash and .to_json
This commit is contained in:
commit
5aeb8cef40
1 changed files with 6 additions and 0 deletions
|
@ -78,6 +78,12 @@ collection = Microformats2.parse(source)
|
||||||
collection.entry.name.to_s #=> "Microformats 2"
|
collection.entry.name.to_s #=> "Microformats 2"
|
||||||
# accessing nested microformats
|
# accessing nested microformats
|
||||||
collection.entry.author.format.name.to_s #=> "Jessica Lynn Suttles"
|
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
|
* `source` can be a URL, filepath, or HTML
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue