Sha256: f7891ce8997a4487b6c12ae702ece5939cd2357c6b6318e3e3f438e404d85bdf

Contents?: true

Size: 511 Bytes

Versions: 3

Compression:

Stored size: 511 Bytes

Contents

module Troo
  class CommentDecorator
    include DecoratorHelpers

    def initialize(comment)
      @comment = comment
    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.4 lib/troo/display/comment_decorator.rb
troo-0.0.3 lib/troo/display/comment_decorator.rb
troo-0.0.2 lib/troo/display/comment_decorator.rb