Class: Schatter::Command::DeleteMessage
- Inherits:
-
Object
- Object
- Schatter::Command::DeleteMessage
- Includes:
- Index
- Defined in:
- lib/schatter/command/delete_message.rb
Constant Summary
Constants included from Index
Instance Attribute Summary collapse
-
#conversation ⇒ Object
readonly
Returns the value of attribute conversation.
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
- #execute(index) ⇒ Object
-
#initialize(conversation) ⇒ DeleteMessage
constructor
A new instance of DeleteMessage.
Methods included from Index
Constructor Details
#initialize(conversation) ⇒ DeleteMessage
Returns a new instance of DeleteMessage.
8 9 10 11 12 |
# File 'lib/schatter/command/delete_message.rb', line 8 def initialize conversation @conversation = conversation @usage = '<index>' @help = 'Deletes the specified message' end |
Instance Attribute Details
#conversation ⇒ Object (readonly)
Returns the value of attribute conversation.
6 7 8 |
# File 'lib/schatter/command/delete_message.rb', line 6 def conversation @conversation end |
#help ⇒ Object (readonly)
Returns the value of attribute help.
6 7 8 |
# File 'lib/schatter/command/delete_message.rb', line 6 def help @help end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
6 7 8 |
# File 'lib/schatter/command/delete_message.rb', line 6 def usage @usage end |
Instance Method Details
#execute(index) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/schatter/command/delete_message.rb', line 14 def execute index = conversation..values[from_index(index)] unless puts "invalid index" return end .destroy puts "message #{index} destroyed" end |