class Schatter::Command::ListMessages
Attributes
conversation[R]
help[R]
usage[R]
Public Class Methods
new(conversation)
click to toggle source
# File lib/schatter/command/list_messages.rb, line 10 def initialize conversation @conversation = conversation @usage = '' @help = 'Lists messages for the current conversation' end
Public Instance Methods
description(message, index)
click to toggle source
# File lib/schatter/command/list_messages.rb, line 22 def description message, index person = conversation.people[message.person_id] parent_index = conversation.messages.keys.index message.parent_id email = person ? person.email : '?' list = [ c(to_index(index), :yellow), c(message.formatted_timestamp, :blue), c(email, :magenta), message.content ] list << c("(reply to #{to_index(parent_index)})", :green) if parent_index list.join ' ' end
execute(*ignored)
click to toggle source
# File lib/schatter/command/list_messages.rb, line 16 def execute *ignored conversation.messages(true).values.each_with_index do |message, index| puts description message, index end end