Class: Html2rss::AutoSource::Scraper::WordpressApi::PageScope::DateArchiveRange
- Inherits:
-
Object
- Object
- Html2rss::AutoSource::Scraper::WordpressApi::PageScope::DateArchiveRange
- Defined in:
- lib/html2rss/auto_source/scraper/wordpress_api/page_scope/date_archive_range.rb
Overview
Maps scoped archive path segments to WordPress REST +after+/+before+ bounds.
Owns date-path shape detection and calendar range math only. Body-class taxonomy/author signals and pagination stay on Resolver.
Class Method Summary collapse
-
.from_segments(segments) ⇒ Hash{String => String}?
+after+/+before+ ISO8601 bounds, or
nil. -
.path?(segments) ⇒ Boolean
Whether segments match a year[/month[/day]] archive shape.
Class Method Details
.from_segments(segments) ⇒ Hash{String => String}?
Returns +after+/+before+ ISO8601 bounds, or nil.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/html2rss/auto_source/scraper/wordpress_api/page_scope/date_archive_range.rb', line 19 def self.from_segments(segments) components = components_from(segments) return unless components start_date = Date.new(*components.fetch(:start_date_parts)) { 'after' => iso8601_start(start_date), 'before' => iso8601_start(next_archive_boundary(start_date, components.fetch(:precision))) } rescue Date::Error nil end |
.path?(segments) ⇒ Boolean
Returns whether segments match a year[/month[/day]] archive shape.
35 36 37 |
# File 'lib/html2rss/auto_source/scraper/wordpress_api/page_scope/date_archive_range.rb', line 35 def self.path?(segments) !date_segments_from(segments).nil? end |