Class: HMachine::Microformat::VoteLinks

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

Constant Summary collapse

FRIENDLY_NAME =
"VoteLinks"
WIKI_URL =
'http://microformats.org/wiki/vote-links'
XMDP =
'http://microformats.org/profile/vote-links'

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::Anchor

#to_s

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, #inspect, many, name, one, parent, properties, #properties, property_of?, remove_nested, search, selector, #to_h, #to_html, #to_s, 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

#abstain?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/hmachine/microformat/votelinks.rb', line 36

def abstain?
  type == 'vote-abstain'
end

#against?Boolean

Returns:

  • (Boolean)


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

def against?
  type == 'vote-against'
end

#for?Boolean

Returns:

  • (Boolean)


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

def for?
  type == 'vote-for'
end

#typeObject



21
22
23
24
25
26
# File 'lib/hmachine/microformat/votelinks.rb', line 21

def type
  vote_type = node['rev'].split(' ').reject do |vote| 
    vote.index('vote-') != 0
  end
  vote_type.first
end

#voteObject



17
18
19
# File 'lib/hmachine/microformat/votelinks.rb', line 17

def vote
  @vote ||= { type => [url, title].compact }
end