Class: Rack::RackSeo::Document
- Inherits:
-
Nokogiri::HTML::Document
- Object
- Nokogiri::HTML::Document
- Rack::RackSeo::Document
- Defined in:
- lib/rack-seo/document.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
This is a wrapper for the Nokogiri parsed page Provides some convenience methods for working with seo meta tags.
-
#keywords ⇒ Object
This is a wrapper for the Nokogiri parsed page Provides some convenience methods for working with seo meta tags.
-
#title ⇒ Object
This is a wrapper for the Nokogiri parsed page Provides some convenience methods for working with seo meta tags.
Class Method Summary collapse
- .new(*args) ⇒ Object
- .parse(string_or_io, url = nil, encoding = 'utf-8', options = Nokogiri::XML::ParseOptions::RECOVER) ⇒ Object
Instance Method Summary collapse
- #description_content ⇒ Object
- #description_content=(content) ⇒ Object
- #description_tag ⇒ Object
- #keywords_content ⇒ Object
- #keywords_content=(content) ⇒ Object
- #keywords_tag ⇒ Object
- #title_content ⇒ Object
- #title_content=(content) ⇒ Object
- #title_tag ⇒ Object
Instance Attribute Details
#desc ⇒ Object
This is a wrapper for the Nokogiri parsed page Provides some convenience methods for working with seo meta tags
5 6 7 |
# File 'lib/rack-seo/document.rb', line 5 def desc @desc end |
#keywords ⇒ Object
This is a wrapper for the Nokogiri parsed page Provides some convenience methods for working with seo meta tags
5 6 7 |
# File 'lib/rack-seo/document.rb', line 5 def keywords @keywords end |
#title ⇒ Object
This is a wrapper for the Nokogiri parsed page Provides some convenience methods for working with seo meta tags
5 6 7 |
# File 'lib/rack-seo/document.rb', line 5 def title @title end |
Class Method Details
.new(*args) ⇒ Object
8 9 10 11 |
# File 'lib/rack-seo/document.rb', line 8 def new(*args) doc = parse(args.first) (doc) end |
.parse(string_or_io, url = nil, encoding = 'utf-8', options = Nokogiri::XML::ParseOptions::RECOVER) ⇒ Object
13 14 15 |
# File 'lib/rack-seo/document.rb', line 13 def parse(string_or_io, url = nil, encoding = 'utf-8', = Nokogiri::XML::ParseOptions::RECOVER) super(string_or_io, url, encoding, ) end |
Instance Method Details
#description_content ⇒ Object
34 35 36 |
# File 'lib/rack-seo/document.rb', line 34 def description_content self.description_tag.attr('content') unless description_tag.nil? end |
#description_content=(content) ⇒ Object
30 31 32 |
# File 'lib/rack-seo/document.rb', line 30 def description_content=(content) self.description_tag['content'] = content unless description_tag.nil? end |
#description_tag ⇒ Object
38 39 40 |
# File 'lib/rack-seo/document.rb', line 38 def description_tag self.at_css("meta[name='description']") end |
#keywords_content ⇒ Object
46 47 48 |
# File 'lib/rack-seo/document.rb', line 46 def keywords_content keywords_tag.attr('content') unless keywords_tag.nil? end |
#keywords_content=(content) ⇒ Object
42 43 44 |
# File 'lib/rack-seo/document.rb', line 42 def keywords_content=(content) keywords_tag['content'] = content unless keywords_tag.nil? end |
#keywords_tag ⇒ Object
50 51 52 |
# File 'lib/rack-seo/document.rb', line 50 def keywords_tag self.at_css("meta[name='keywords']") end |
#title_content ⇒ Object
18 19 20 |
# File 'lib/rack-seo/document.rb', line 18 def title_content self.title_tag.text end |
#title_content=(content) ⇒ Object
22 23 24 |
# File 'lib/rack-seo/document.rb', line 22 def title_content=(content) title_tag.content = content end |
#title_tag ⇒ Object
26 27 28 |
# File 'lib/rack-seo/document.rb', line 26 def title_tag self.at('title') end |