module Tr3llo::View::Card::Comments

Public Instance Methods

render(comments) click to toggle source
# File lib/3llo/view/card/comments.rb, line 7
def render(comments)
  if comments.any?
    comments
      .map { |comment| render_comment(comment) }
      .join("\n\n")
  else
    "No comments on this card yet. Use #{Utils.format_highlight("card comment")} to write the first comment."
  end
end

Private Instance Methods

format_date_time(date_time) click to toggle source
# File lib/3llo/view/card/comments.rb, line 26
def format_date_time(date_time)
  Utils.format_dim(date_time.strftime("%b %d, %Y %H:%M:%S"))
end
render_comment(comment) click to toggle source
# File lib/3llo/view/card/comments.rb, line 19
        def render_comment(comment)
          <<~TEMPLATE.strip
          #{Utils.format_bold(Utils.format_user(comment.creator))} on <#{format_date_time(comment.created_at)}> wrote:
          #{comment.text}
          TEMPLATE
        end