Class: Trumail::Parser::Xml

Inherits:
Base
  • Object
show all
Defined in:
lib/trumail/parser/xml.rb

Instance Attribute Summary

Attributes inherited from Base

#hash

Instance Method Summary collapse

Methods inherited from Base

#initialize, parse

Constructor Details

This class inherits a constructor from Trumail::Parser::Base

Instance Method Details

#parseObject

rubocop:disable Security/Eval



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/trumail/parser/xml.rb', line 10

def parse
  @hash = Ox.load(@data, mode: :hash_no_attrs)
            .dig(:lookup)
            .each_with_object({}) do |(key, val), hash|
              hash[key.to_s] = begin
                                 eval(val)
                               rescue StandardError, SyntaxError
                                 val
                               end
            end
end