Sha256: cdf473d1ec46f19717dabcbd2cc30321c375bafba7aee915f63b4106be4d0fb8

Contents?: true

Size: 896 Bytes

Versions: 1

Compression:

Stored size: 896 Bytes

Contents

require 'nokogiri'

module EM
  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.from_xml(e)}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-redfinger-0.1.0 lib/em-redfinger/link_helpers.rb