Class: Atom::Link

Inherits:
Element show all
Includes:
AttrEl
Defined in:
lib/atom/element.rb

Overview

A link has the following attributes:

href (required)

the link’s IRI

rel

the relationship of the linked item to the current item

type

a hint about the media type of the linked item

hreflang

the language of the linked item (RFC3066)

title

human-readable information about the link

length

a hint about the length (in octets) of the linked item

Instance Attribute Summary

Attributes inherited from Element

#base, #extensions

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AttrEl

#[], #[]=

Methods inherited from Element

#append_elem, attributes, #build, builders, def_get, def_set, do_parsing, #get, #get_atom_attrb, #get_atom_elem, #get_atom_elems, #get_elem, #get_elems, #initialize, is_atom_element, is_element, on_build, on_init, run_initters, #set, #set_atom_attrb, #to_s, #to_xml

Methods included from Parsers

#on_parse, #on_parse_attr, #on_parse_many, #on_parse_root, #parse_plain

Methods included from Converters

#atom_attrb, #atom_element, #atom_elements, #atom_link, #atom_string, #atom_time, #attrb, #build_plain, #element, #elements, #strings, #time

Constructor Details

This class inherits a constructor from Atom::Element

Class Method Details

.parse(xml, base = '') ⇒ Object



601
602
603
604
605
606
607
608
609
610
# File 'lib/atom/element.rb', line 601

def self.parse xml, base = ''
  e = super

  # URL absolutization
  if !e.base.empty? and e.href
    e.href = (e.base.to_uri + e.href).to_s
  end

  e
end

Instance Method Details

#relObject



597
598
599
# File 'lib/atom/element.rb', line 597

def rel
  @rel or 'alternate'
end