Class: MassTransit::Message

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

Overview

creates a method missing style dictionary for when i don't have the actual type availible

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Message


10
11
12
13
# File 'lib/masstransit/message.rb', line 10

def initialize(hash)
  @hash = hash
  @o = OpenStruct.new hash
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object


15
16
17
18
19
20
21
22
# File 'lib/masstransit/message.rb', line 15

def method_missing(name, *args)
  value = @o.send name, args 
  if value.class == Hash
    value = Message.new value
  end
  return value unless value.nil?
  super
end

Instance Attribute Details

#hashObject

Returns the value of attribute hash


8
9
10
# File 'lib/masstransit/message.rb', line 8

def hash
  @hash
end