Class: MetaInspector::Parsers::HeadLinksParser
- Inherits:
-
Base
- Object
- Base
- MetaInspector::Parsers::HeadLinksParser
show all
- Defined in:
- lib/meta_inspector/parsers/head_links.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#canonicals ⇒ Object
23
24
25
|
# File 'lib/meta_inspector/parsers/head_links.rb', line 23
def canonicals
@canonicals ||= head_links.select { |hl| hl[:rel] == 'canonical' }
end
|
#feed ⇒ Object
Returns the parsed document meta rss link
28
29
30
|
# File 'lib/meta_inspector/parsers/head_links.rb', line 28
def feed
@feed ||= (parsed_feed('rss') || parsed_feed('atom'))
end
|
#head_links ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/meta_inspector/parsers/head_links.rb', line 6
def head_links
@head_links ||= parsed.css('head link').map do |tag|
Hash[
tag.attributes.keys.map do |key|
keysym = key.to_sym
val = tag.attributes[key].value
val = URL.absolutify(val, base_url) if keysym == :href
[keysym, val]
end
]
end
end
|
#stylesheets ⇒ Object
19
20
21
|
# File 'lib/meta_inspector/parsers/head_links.rb', line 19
def stylesheets
@stylesheets ||= head_links.select { |hl| hl[:rel] == 'stylesheet' }
end
|