Class: Remq::Message

Inherits:
Struct
  • Object
show all
Defined in:
lib/remq.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#bodyObject

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



6
7
8
# File 'lib/remq.rb', line 6

def body
  @body
end

#channelObject

Returns the value of attribute channel

Returns:

  • (Object)

    the current value of channel



6
7
8
# File 'lib/remq.rb', line 6

def channel
  @channel
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



6
7
8
# File 'lib/remq.rb', line 6

def id
  @id
end

Class Method Details

.parse(raw) ⇒ Object



8
9
10
11
12
# File 'lib/remq.rb', line 8

def Message.parse(raw)
  header, body = raw.split("\n", 2)
  channel, id = header.split('@', 2)
  new(channel, id.to_i, body)
end