Class: MassTransit::Message
- Inherits:
-
Object
- Object
- MassTransit::Message
- 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
-
#hash ⇒ Object
Returns the value of attribute hash.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Message
constructor
A new instance of Message.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(hash) ⇒ Message
Returns a new instance of 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
#hash ⇒ Object
Returns the value of attribute hash.
8 9 10 |
# File 'lib/masstransit/message.rb', line 8 def hash @hash end |