Class: Pello::CardLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/pello/card_logger.rb

Instance Method Summary collapse

Instance Method Details

#log(user, card, event) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/pello/card_logger.rb', line 3

def log(user, card, event)
  comment = card.comments.select { |c| c.creator_id == user.id && c.data['text'] =~ /PELLO LOG/ }.first
  if comment
    text = [comment.data['text'], event].join("\n")
    comment.delete
  else
    text = ['~~~PELLO LOG', event].join("\n")
  end
  card.add_comment text
end