Class: Ellen::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/ellen/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options)
  @body = options[:body]
  @source = options[:source]
  @command = options[:command]
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/ellen/message.rb', line 3

def body
  @body
end

#commandObject (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/ellen/message.rb', line 3

def command
  @command
end

#match_dataObject (readonly)

Returns the value of attribute match_data.



3
4
5
# File 'lib/ellen/message.rb', line 3

def match_data
  @match_data
end

#sourceObject (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