lib/rixml.rb in rixml-0.4.9 vs lib/rixml.rb in rixml-0.5.0

- old
+ new

@@ -1,22 +1,28 @@ # frozen_string_literal: true require 'nokogiri' require 'date' require 'active_support/core_ext/hash/conversions' require 'active_support/inflector/inflections' +require_relative './rixml_document' # rubocop:disable Metrics/ClassLength class RIXML class << self def parse_from_file(filename) RIXML.new(File.read(filename)) end end def initialize(data) + @data = data @document = Nokogiri::XML(data) @attrs = Hash.from_xml(@document.root.to_s) @document.remove_namespaces! + end + + def research + @rixml_document ||= RixmlDocument.parse(@data) end def product_id @attrs.dig('Research', 'Product', 'productID') end