Class: Ellen::Message
- Inherits:
-
Object
- Object
- Ellen::Message
- Defined in:
- lib/ellen/message.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#match_data ⇒ Object
readonly
Returns the value of attribute match_data.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(options) ⇒ Message
constructor
A new instance of Message.
- #match(pattern) ⇒ Object
Constructor Details
#initialize(options) ⇒ Message
Returns a new instance of Message.
5 6 7 8 9 |
# File 'lib/ellen/message.rb', line 5 def initialize() @body = [:body] @source = [:source] @command = [:command] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/ellen/message.rb', line 3 def body @body end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/ellen/message.rb', line 3 def command @command end |
#match_data ⇒ Object (readonly)
Returns the value of attribute match_data.
3 4 5 |
# File 'lib/ellen/message.rb', line 3 def match_data @match_data end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/ellen/message.rb', line 3 def source @source end |
Instance Method Details
#[](index) ⇒ Object
15 16 17 |
# File 'lib/ellen/message.rb', line 15 def [](index) match_data[index] end |
#match(pattern) ⇒ Object
11 12 13 |
# File 'lib/ellen/message.rb', line 11 def match(pattern) @match_data = pattern.match(body) end |