Class: SemiStatic::News

Inherits:
Page
  • Object
show all
Defined in:
lib/semi_static/news.rb

Instance Attribute Summary collapse

Attributes inherited from Page

#body, #slug, #title

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Page

find, first, #initialize, #persisted?, #render, #to_s

Constructor Details

This class inherits a constructor from SemiStatic::Page

Instance Attribute Details

#published_atObject

Returns the value of attribute published_at.



4
5
6
# File 'lib/semi_static/news.rb', line 4

def published_at
  @published_at
end

Class Method Details

.allObject



7
8
9
# File 'lib/semi_static/news.rb', line 7

def self.all
  super.sort_by(&:published_at).reverse
end

Instance Method Details

#idObject

used for atom feed



12
13
14
# File 'lib/semi_static/news.rb', line 12

def id
  Digest::MD5.hexdigest to_param
end

#to_paramObject



16
17
18
# File 'lib/semi_static/news.rb', line 16

def to_param
  "#{year}/#{month}/#{day}/#{super}"
end