Class: Html2rss::AttributePostProcessors::ParseTime
- Inherits:
-
Object
- Object
- 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 Method Summary collapse
-
#get ⇒ String
Converts the provided time string to RFC822 format, taking into account the configured time zone.
-
#initialize(value, env) ⇒ ParseTime
constructor
A new instance of ParseTime.
Constructor Details
#initialize(value, env) ⇒ ParseTime
Returns a new instance of ParseTime.
32 33 34 35 |
# File 'lib/html2rss/attribute_post_processors/parse_time.rb', line 32 def initialize(value, env) @value = value.to_s @time_zone = env[:config].time_zone end |