Class: Troo::CommentDecorator
- Inherits:
-
Object
- Object
- Troo::CommentDecorator
- Includes:
- DecoratorHelpers
- Defined in:
- lib/troo/display/comment_decorator.rb
Instance Method Summary collapse
- #as_view ⇒ Object
- #date ⇒ Object
- #id ⇒ Object
-
#initialize(comment) ⇒ CommentDecorator
constructor
A new instance of CommentDecorator.
- #member_username ⇒ Object
- #text ⇒ Object
Methods included from DecoratorHelpers
Constructor Details
#initialize(comment) ⇒ CommentDecorator
Returns a new instance of CommentDecorator.
5 6 7 |
# File 'lib/troo/display/comment_decorator.rb', line 5 def initialize(comment) @comment = comment end |
Instance Method Details
#as_view ⇒ Object
9 10 11 |
# File 'lib/troo/display/comment_decorator.rb', line 9 def as_view Template.parse(self, "/../views/comment.erb") end |
#date ⇒ Object
21 22 23 |
# File 'lib/troo/display/comment_decorator.rb', line 21 def date Time.parse(comment.date).strftime("%a, %b %d at %H:%M") end |
#id ⇒ Object
25 26 27 |
# File 'lib/troo/display/comment_decorator.rb', line 25 def id brackets(comment.id) end |
#member_username ⇒ Object
13 14 15 |
# File 'lib/troo/display/comment_decorator.rb', line 13 def member_username [comment.member.username, ":"].join end |
#text ⇒ Object
17 18 19 |
# File 'lib/troo/display/comment_decorator.rb', line 17 def text word_wrap(comment.text) end |