Sha256: 78518927b39555d863df7eebb8ca4b3340e7fbd49026d4ffcc2f1d9df352efed

Contents?: true

Size: 550 Bytes

Versions: 3

Compression:

Stored size: 550 Bytes

Contents

module Troo
  class CommentDecorator
    include DecoratorHelpers

    def initialize(comment, options = {})
      @comment = comment
      @options = options
    end

    def as_view
      Template.parse(self, "/../views/comment.erb")
    end

    def member_username
      [comment.member.username, ":"].join
    end

    def text
      word_wrap(comment.text)
    end

    def date
      Time.parse(comment.date).strftime("%a, %b %d at %H:%M")
    end

    def id
      brackets(comment.id)
    end

    private
    attr_reader :comment
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troo-0.0.7 lib/troo/display/comment_decorator.rb
troo-0.0.6 lib/troo/display/comment_decorator.rb
troo-0.0.5 lib/troo/display/comment_decorator.rb