Class: Hightouch::Archive
- Inherits:
-
Object
- Object
- Hightouch::Archive
- Includes:
- Virtus
- Defined in:
- lib/hightouch/archive.rb
Direct Known Subclasses
Instance Method Summary collapse
- #add_blog_posting(blog_posting) ⇒ Object
- #blog_postings ⇒ Object
- #count ⇒ Object
- #empty? ⇒ Boolean
- #path ⇒ Object
- #remove_blog_posting(blog_posting) ⇒ Object
Instance Method Details
#add_blog_posting(blog_posting) ⇒ Object
13 14 15 |
# File 'lib/hightouch/archive.rb', line 13 def add_blog_posting(blog_posting) blog_posting_cache[blog_posting.name] = blog_posting end |
#blog_postings ⇒ Object
9 10 11 |
# File 'lib/hightouch/archive.rb', line 9 def blog_postings Hash[blog_posting_cache.sort_by { |k, v| v.date_created }.reverse] end |
#count ⇒ Object
26 27 28 |
# File 'lib/hightouch/archive.rb', line 26 def count blog_posting_cache.size end |
#empty? ⇒ Boolean
22 23 24 |
# File 'lib/hightouch/archive.rb', line 22 def empty? blog_posting_cache.empty? end |
#path ⇒ Object
30 31 32 |
# File 'lib/hightouch/archive.rb', line 30 def path "/blog/#{name}/index.html" end |
#remove_blog_posting(blog_posting) ⇒ Object
17 18 19 20 |
# File 'lib/hightouch/archive.rb', line 17 def remove_blog_posting(blog_posting) blog_posting_cache.delete(blog_posting.name) blog.remove_archive(self) if empty? end |