Class: Schatter::Command::ListConversations
- Inherits:
-
Object
- Object
- Schatter::Command::ListConversations
- Includes:
- Schatter::Colour, Index
- Defined in:
- lib/schatter/command/list_conversations.rb
Constant Summary
Constants included from Index
Instance Attribute Summary collapse
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
- #description(conversation, index) ⇒ Object
- #execute(ignored) ⇒ Object
-
#initialize(session) ⇒ ListConversations
constructor
A new instance of ListConversations.
Methods included from Index
Methods included from Schatter::Colour
Constructor Details
#initialize(session) ⇒ ListConversations
Returns a new instance of ListConversations.
10 11 12 13 14 |
# File 'lib/schatter/command/list_conversations.rb', line 10 def initialize session @session = session @usage = '' @help = 'Lists current conversations' end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
8 9 10 |
# File 'lib/schatter/command/list_conversations.rb', line 8 def help @help end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
8 9 10 |
# File 'lib/schatter/command/list_conversations.rb', line 8 def session @session end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
8 9 10 |
# File 'lib/schatter/command/list_conversations.rb', line 8 def usage @usage end |
Instance Method Details
#description(conversation, index) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/schatter/command/list_conversations.rb', line 22 def description conversation, index [ c(to_index(index), :yellow), c(conversation., :blue), c(conversation.name, :magenta), ].join ' ' end |
#execute(ignored) ⇒ Object
16 17 18 19 20 |
# File 'lib/schatter/command/list_conversations.rb', line 16 def execute ignored session.conversations(true).values.each_with_index do |conversation, index| puts description conversation, index end end |