Class: Schatter::Command::JoinConversation
- Inherits:
-
Object
- Object
- Schatter::Command::JoinConversation
- Includes:
- Index
- Defined in:
- lib/schatter/command/join_conversation.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
- #execute(index) ⇒ Object
-
#initialize(session) ⇒ JoinConversation
constructor
A new instance of JoinConversation.
Methods included from Index
Constructor Details
#initialize(session) ⇒ JoinConversation
Returns a new instance of JoinConversation.
9 10 11 12 13 |
# File 'lib/schatter/command/join_conversation.rb', line 9 def initialize session @session = session @usage = '<index>' @help = 'Joins a specified conversation' end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
7 8 9 |
# File 'lib/schatter/command/join_conversation.rb', line 7 def help @help end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
7 8 9 |
# File 'lib/schatter/command/join_conversation.rb', line 7 def session @session end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
7 8 9 |
# File 'lib/schatter/command/join_conversation.rb', line 7 def usage @usage end |
Instance Method Details
#execute(index) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/schatter/command/join_conversation.rb', line 15 def execute index conversation = session.conversations.values[from_index(index)] unless conversation puts "invalid index" return end Schatter::ConversationContext.new(conversation).push end |