class Troo::Presenters::Comment
Attributes
card[R]
Public Class Methods
new(card, options = {})
click to toggle source
@param [Troo::Card] @param [Hash] @return [Troo::Presenters::Comment]
# File lib/troo/presenters/comment.rb, line 9 def initialize(card, options = {}) @card, @options = card, options end
Public Instance Methods
show()
click to toggle source
@return []
# File lib/troo/presenters/comment.rb, line 14 def show title if comments? all_comments else no_comments end end
Private Instance Methods
all_comments()
click to toggle source
# File lib/troo/presenters/comment.rb, line 32 def all_comments comments.map do |comment| output.render comment.decorator.as_view end nil end
comments()
click to toggle source
# File lib/troo/presenters/comment.rb, line 47 def comments @comments ||= card.comments end
comments?()
click to toggle source
# File lib/troo/presenters/comment.rb, line 43 def comments? comments.any? end
no_comments()
click to toggle source
# File lib/troo/presenters/comment.rb, line 39 def no_comments output.render error('No comments were found.') end
output()
click to toggle source
# File lib/troo/presenters/comment.rb, line 28 def output @output ||= Troo::Output.new end
title()
click to toggle source
# File lib/troo/presenters/comment.rb, line 51 def title output.render card.decorator.title + "\n" end