lib/feedjira/feed_entry_utilities.rb in feedjira-2.2.0 vs lib/feedjira/feed_entry_utilities.rb in feedjira-3.0.0.beta1
- old
+ new
@@ -11,11 +11,11 @@
def parse_datetime(string)
DateTime.parse(string).feed_utils_to_gm_time
rescue StandardError => e
Feedjira.logger.warn { "Failed to parse date #{string.inspect}" }
- Feedjira.logger.debug(e)
+ Feedjira.logger.warn(e)
nil
end
##
# Returns the id of the entry or its url if not id is present, as some
@@ -26,18 +26,18 @@
##
# Writer for published. By default, we keep the "oldest" publish time found.
def published=(val)
parsed = parse_datetime(val)
- @published = parsed if parsed && (!@published || parsed < @published)
+ @published = parsed if !@published || parsed < @published
end
##
# Writer for updated. By default, we keep the most recent update time found.
def updated=(val)
parsed = parse_datetime(val)
- @updated = parsed if parsed && (!@updated || parsed > @updated)
+ @updated = parsed if !@updated || parsed > @updated
end
def sanitize!
%w(title author summary content image).each do |name|
if respond_to?(name) && send(name).respond_to?(:sanitize!)
@@ -50,10 +50,10 @@
def each
@rss_fields ||= instance_variables
@rss_fields.each do |field|
- yield(field.to_s.sub('@', ''), instance_variable_get(field))
+ yield(field.to_s.sub("@", ""), instance_variable_get(field))
end
end
def [](field)
instance_variable_get("@#{field}")