Sha256: d45ca73114a56821a62b414e802b3f535b3092847a45cb3b5cf4a347ab272d8c

Contents?: true

Size: 819 Bytes

Versions: 5

Compression:

Stored size: 819 Bytes

Contents

require 'nokogiri'

module Redfinger
  module LinkHelpers
    # An array of links with hCard information about this e-mail address.
    def hcard
      relmap('http://microformats.org/profile/hcard')
    end
    
    # An array of links of OpenID providers for this e-mail address.
    def open_id
      relmap('http://specs.openid.net/auth/', true)
    end
    
    # An array of links to profile pages belonging to this e-mail address.
    def profile_page
      relmap('http://webfinger.net/rel/profile-page')
    end
    
    # An array of links to XFN compatible URLs for this e-mail address.
    def xfn
      relmap('http://gmpg.org/xfn/', true)
    end
    
    protected
    
    def relmap(uri, substring=false)
      @doc.css("Link[rel#{'^' if substring}=\"#{uri}\"]").map{|e| Link.new(e)}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
redfinger-0.0.6 lib/redfinger/link_helpers.rb
redfinger-0.0.5 lib/redfinger/link_helpers.rb
redfinger-0.0.4 lib/redfinger/link_helpers.rb
redfinger-0.0.3 lib/redfinger/link_helpers.rb
redfinger-0.0.2 lib/redfinger/link_helpers.rb