Module: FeedNormalizer::TimeFix

Included in:
Entry, Feed
Defined in:
lib/structures.rb

Instance Method Summary collapse

Instance Method Details

#reparse(obj) ⇒ Object

Reparse any Time instances, due to RSS::Parser’s redefinition of certain aspects of the Time class that creates unexpected behaviour when extending the Time class, as some common third party libraries do. See code.google.com/p/feed-normalizer/issues/detail?id=13.



123
124
125
126
127
128
129
130
131
132
# File 'lib/structures.rb', line 123

def reparse(obj)
  @parsed ||= false

  return obj if @parsed

  if obj.is_a?(Time)
    @parsed = true
    Time.at(obj) rescue obj
  end
end