Class: Gandalf::Post
- Inherits:
-
Object
- Object
- Gandalf::Post
- Includes:
- DataMapper::Resource
- Defined in:
- lib/gandalf/models.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.parse(feed) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/gandalf/models.rb', line 42 def Post.parse(feed) feed.entries.map do |entry| post = self.new({ :title => entry.title, :link => entry.url, :author => entry., :description => entry.summary, :pub_date => entry.published.to_datetime, :cache_link => Digest::MD5.hexdigest(entry.url) }) end end |
Instance Method Details
#clean! ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/gandalf/models.rb', line 34 def clean! self.title = self.title[0,255] if self.description self.description.gsub!(/\<[^\>]+\>|\n| /,' ') self.description.gsub!(/\s{2,}/,' ') end end |