Module: Blogpostify::ViewHelpers

Defined in:
lib/blogpostify/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#all_blogs(options = {}, &block) ⇒ Object



13
14
15
16
17
18
# File 'lib/blogpostify/view_helpers.rb', line 13

def all_blogs(options={}, &block)
  Blogpostify.blogs.each do |blog|
    yield blog, get_posts(blog, options) if block_given?
  end
  return nil
end

#blog_posts_for(blog_name, options = {}, &block) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/blogpostify/view_helpers.rb', line 4

def blog_posts_for(blog_name, options={}, &block)
  blog = Blogpostify.find_blog!(blog_name)

  if block_given?
    yield blog, get_posts(blog, options)
    return nil # Block should do all of the rendering
  end
end