Sha256: 0f166930796e3a2858935a6c4f606f40a88acc69dffc262fc611b184881970db

Contents?: true

Size: 616 Bytes

Versions: 1

Compression:

Stored size: 616 Bytes

Contents

module Troo
  module Decorators
    class Comment
      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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 lib/troo/decorators/comment.rb