Class: Akki::Article
- Inherits:
-
Object
- Object
- Akki::Article
- Defined in:
- lib/akki/article.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#date ⇒ Object
Returns the value of attribute date.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params) ⇒ Article
constructor
A new instance of Article.
- #path ⇒ Object
Constructor Details
#initialize(params) ⇒ Article
Returns a new instance of Article.
7 8 9 10 11 12 |
# File 'lib/akki/article.rb', line 7 def initialize(params) @title = params[:title] @date = params[:date] @content = params[:content] @slug = params[:slug] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'lib/akki/article.rb', line 5 def content @content end |
#date ⇒ Object
Returns the value of attribute date.
5 6 7 |
# File 'lib/akki/article.rb', line 5 def date @date end |
#slug ⇒ Object
Returns the value of attribute slug.
5 6 7 |
# File 'lib/akki/article.rb', line 5 def slug @slug end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/akki/article.rb', line 5 def title @title end |
Class Method Details
.all ⇒ Object
19 20 21 22 23 24 |
# File 'lib/akki/article.rb', line 19 def all unless defined? @articles @articles = get_all_articles end @articles end |
.find(year, month, day, slug) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/akki/article.rb', line 26 def find year, month, day, slug article = all.select { |article| article.date.year == year && article.date.month == month && article.date.day == day && article.slug == slug }.first end |
Instance Method Details
#path ⇒ Object
14 15 16 |
# File 'lib/akki/article.rb', line 14 def path date.strftime("/%Y/%m/%d/") + slug end |