Class: CamtParser::Type::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/camt_parser/general/type/builder.rb

Class Method Summary collapse

Class Method Details

.build_type(xml_data) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/camt_parser/general/type/builder.rb', line 4

def self.build_type(xml_data)
  if xml_data.xpath('Prtry').any?
    Proprietary.new(
      xml_data.xpath('Prtry/Id/text()').text,
      xml_data.xpath('Prtry/Issr/text()').text
    )
  elsif xml_data.xpath('Cd').any?
    Code.new(xml_data.xpath('Cd/text()').text)
  else
    nil
  end
end