lib/rixml.rb in rixml-0.3.0 vs lib/rixml.rb in rixml-0.4.0

- old
+ new

@@ -2,10 +2,11 @@ require 'nokogiri' require 'date' require 'active_support/core_ext/hash/conversions' require 'active_support/inflector/inflections' +# rubocop:disable Metrics/ClassLength class RIXML class << self def parse_from_file(filename) RIXML.new(File.read(filename)) end @@ -63,9 +64,18 @@ abstract: content['Abstract'], synopsis: content['Synopsis'], file_name: content['Resource']&.dig('Name'), pages: content['Resource']&.dig('Length').to_i } + end + + def asset_classes + assets = @attrs.dig('Research', 'Product', 'Source', 'Organization', 'Expertise', 'AssetClasses', 'AssetClass') + assets = [assets] unless assets.is_a?(Array) + + assets.collect do |asset| + asset&.dig('assetClass') + end.compact end def context context = @attrs.dig('Research', 'Product', 'Context') || {} {