Class: SitemapParser
- Inherits:
-
Object
- Object
- SitemapParser
- Defined in:
- lib/sitemaps_parsers.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#list_nested_sitemap ⇒ Object
readonly
Returns the value of attribute list_nested_sitemap.
-
#robots_sitemap_path ⇒ Object
readonly
Returns the value of attribute robots_sitemap_path.
Instance Method Summary collapse
-
#initialize(domain) ⇒ SitemapParser
constructor
A new instance of SitemapParser.
- #sitemap_path ⇒ Object
- #urls ⇒ Object
Constructor Details
#initialize(domain) ⇒ SitemapParser
Returns a new instance of SitemapParser.
11 12 13 14 |
# File 'lib/sitemaps_parsers.rb', line 11 def initialize(domain) @domain = domain @url = URI.parse("http://#{@domain}") end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
9 10 11 |
# File 'lib/sitemaps_parsers.rb', line 9 def domain @domain end |
#list_nested_sitemap ⇒ Object (readonly)
Returns the value of attribute list_nested_sitemap.
9 10 11 |
# File 'lib/sitemaps_parsers.rb', line 9 def list_nested_sitemap @list_nested_sitemap end |
#robots_sitemap_path ⇒ Object (readonly)
Returns the value of attribute robots_sitemap_path.
9 10 11 |
# File 'lib/sitemaps_parsers.rb', line 9 def robots_sitemap_path @robots_sitemap_path end |
Instance Method Details
#sitemap_path ⇒ Object
22 23 24 25 |
# File 'lib/sitemaps_parsers.rb', line 22 def sitemap_path robots_sitemap check_default_sitemap&.to_s || robots_sitemap_path&.join(',') end |
#urls ⇒ Object
16 17 18 19 20 |
# File 'lib/sitemaps_parsers.rb', line 16 def urls return parse_sitemap(check_default_sitemap) if check_default_sitemap parse_nested_sitemaps(robots_sitemap) end |