Class: HMachine::Microformat::RelTag

Inherits:
POSH::Anchor show all
Defined in:
lib/hmachine/microformat/reltag.rb

Constant Summary collapse

FRIENDLY_NAME =
"rel-tag"
WIKI_URL =
"http://microformats.org/wiki/rel-tag"
XMDP =
'http://microformats.org/profile/rel-tag'

Constants included from HMachine

PRODID, VERSION

Instance Attribute Summary

Attributes inherited from POSH::Base

#node, #parent, #source

Instance Method Summary collapse

Methods inherited from POSH::Base

#[], [], add_property, #each_pair, #empty?, extract, get_properties, has_many, has_many!, has_one, has_one!, #has_property?, inherited, #initialize, many, name, one, parent, #properties, properties, property_of?, remove_nested, search, selector, #to_html, validate

Methods included from HMachine

#extract, #extract_from, find, #find_in, #found_in?, get, get_document, get_url, map, normalize, #parse, #parse_first, #search, #valid?, #validate

Constructor Details

This class inherits a constructor from HMachine::POSH::Base

Instance Method Details

#inspectObject



32
33
34
# File 'lib/hmachine/microformat/reltag.rb', line 32

def inspect
  "<#{self.class}:#{hash}: '#{tag}'>"
end

#nameObject



16
17
18
# File 'lib/hmachine/microformat/reltag.rb', line 16

def name
  tag.keys.to_s
end

#tagObject



12
13
14
# File 'lib/hmachine/microformat/reltag.rb', line 12

def tag
  @tag ||= { node['href'].split('/').last => node['href'] }
end

#to_hObject



28
29
30
# File 'lib/hmachine/microformat/reltag.rb', line 28

def to_h
  tag
end

#to_sObject



20
21
22
# File 'lib/hmachine/microformat/reltag.rb', line 20

def to_s
  name
end

#urlObject



24
25
26
# File 'lib/hmachine/microformat/reltag.rb', line 24

def url
  tag.values.to_s
end