Sha256: 0759a75538659a3f0c6f886db192c46707f3eb098ddd8f0dc37c5f9d30a47d7f

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

module Kublog
  class PostsPresenter
    
    def initialize(category=nil)
      @category = category
    end
    
    def categories
      @categories ||= Category.all
    end
    
    def posts
      @posts ||= @category ? @category.posts : Post.all
    end
    
    def title
      @title ||= @category.nil? ? Kublog.blog_name : "#{@category.name} :: #{Kublog.blog_name}"
    end
    
    def updated
      self.posts.first.try(:updated_at)
    end
    
    def ftime(updated)
      updated.strftime("%Y-%m-%dT%H:%M:%SZ")
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kublog-0.0.1.1 app/presenters/kublog/posts_presenter.rb