From 96ed937040d3dd5da82c5826371ee001f7c5b3cd Mon Sep 17 00:00:00 2001 From: Barnaby Walters Date: Wed, 11 Jun 2014 16:45:17 +0000 Subject: [PATCH] Added usage examples of collection.to_hash and .to_json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per @aaronpk wanting this feature to the point of considering creating a separate parser — turns out it is possible, just a little buried! --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index d5da230..f891f25 100644 --- a/README.md +++ b/README.md @@ -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