Prism - command line and Ruby library parser for Microformats

Prism from Mark Wunsch is a cool Ruby library and command line tool for parsing Microformats. It even supports vCard export:

twitter_contacts = Prism.find '', :hcard
me = twitter_contacts.first
#=> "Mark Wunsch"
#=> "Wunsch"
#=> ""'mark.vcf','w') {|f| f.write me.to_vcard }
## Add me to your address book!

Or if the command line is your bag:

$: prism --hcard > ~/Desktop/me.vcf

or using STDIN and cURL:

$: curl | prism --hcard > ~/Desktop/me.vcf

Prism also includes a DSL for parsing your own POSH formats:

class Navigation < Prism::POSH::Base
    search {|document| document.css('ul#navigation') }
    # Search a Nokogiri document for nodes of a certain type

    validate {|node| node.matches?('ul#navigation') }
    # Validate that a node is the right element we want

    has_many :items do
        search {|doc| doc.css('li') }
    # has_many and has_one define properties, which themselves inherit from
    # Prism::POSH::Base, so you can do :has_one, :has_many, :search, :extract, etc.

[Source on GitHub] [Docs] [Mark Wunsch on Twitter]

News Films

Our little film studio focuses on telling developer-centric stories that need to be seen.

Beyond Code: Season 3 / GopherCon 2015

0:00 / 0:00