Class: RubyAsterisk::AMI::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-asterisk/ami/event.rb

Overview

Immutable value object representing a parsed AMI event. All attributes are frozen for thread-safe sharing.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(headers, raw) ⇒ Event

Returns a new instance of Event.

Parameters:

  • headers (Hash)

    frozen hash of parsed AMI headers (Key => Value strings)

  • raw (String)

    frozen raw message string including the trailing \r\n\r\n



14
15
16
17
18
19
# File 'lib/ruby-asterisk/ami/event.rb', line 14

def initialize(headers, raw)
  @name    = headers['Event'].freeze
  @headers = headers
  @raw     = raw
  freeze
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



10
11
12
# File 'lib/ruby-asterisk/ami/event.rb', line 10

def headers
  @headers
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/ruby-asterisk/ami/event.rb', line 10

def name
  @name
end

#rawObject (readonly)

Returns the value of attribute raw.



10
11
12
# File 'lib/ruby-asterisk/ami/event.rb', line 10

def raw
  @raw
end