Class: Html2rss::AttributePostProcessors::ParseTime
- Defined in:
- lib/html2rss/attribute_post_processors/parse_time.rb
Overview
Returns the / RFC822 representation of a time.
Imagine this HTML structure:
<p>Published on <span>2019-07-02</span></p>
YAML usage example:
selectors:
description:
selector: span
post_process:
name: 'parse_time'
time_zone: 'Europe/Berlin'
Would return:
"Tue, 02 Jul 2019 00:00:00 +0200"
It uses ‘Time.parse`.
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#get ⇒ String
Converts the provided time string to RFC822 format, taking into account the time_zone.
Methods inherited from Base
assert_type, expect_options, #initialize
Constructor Details
This class inherits a constructor from Html2rss::AttributePostProcessors::Base
Class Method Details
.validate_args!(value, context) ⇒ Object
29 30 31 32 |
# File 'lib/html2rss/attribute_post_processors/parse_time.rb', line 29 def self.validate_args!(value, context) assert_type(value, String, :value, context:) assert_type(context[:config].time_zone, String, :time_zone, context:) end |