Sha256: 96366dbb09c5245598bbb34a8f9c9faab51a80e2d47719f34505061d14c2321d

Contents?: true

Size: 431 Bytes

Versions: 1

Compression:

Stored size: 431 Bytes

Contents

require 'nokogiri'
require 'hashie'

module Redfinger
  class Link < Hashie::Mash
    def self.from_xml(xml_link)
      new_link = Link.new
      new_link[:rel]  = xml_link['rel']
      new_link[:href] = xml_link['href']
      new_link[:type] = xml_link['type']
      new_link
    end
    
    # Outputs the URL of the link, useful for using 
    # a Link directly in other libraries.
    def to_s
      self.href
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redfinger-0.1.0 lib/redfinger/link.rb