Class: Hightouch::Archive

Inherits:
Object
  • Object
show all
Includes:
Virtus
Defined in:
lib/hightouch/archive.rb

Direct Known Subclasses

Category

Instance Method Summary collapse

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_postingsObject



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

#countObject



26
27
28
# File 'lib/hightouch/archive.rb', line 26

def count
  blog_posting_cache.size
end

#empty?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/hightouch/archive.rb', line 22

def empty?
  blog_posting_cache.empty?
end

#pathObject



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