Class: Mundipagg::Message

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

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Message

Returns a new instance of Message.



5
6
7
# File 'lib/mundipagg/message.rb', line 5

def initialize(hash)
  @hash = hash
end

Instance Method Details

#translateObject



9
10
11
12
13
14
# File 'lib/mundipagg/message.rb', line 9

def translate
  @hash.each_with_object(Hash.new) do |(key, value), hash|
    key = Mundipagg::Key.new(key).to_s
    hash[key] = value.is_a?(Hash) ? self.class.new(value).translate : value
  end
end