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

- old
+ new

@@ -62,11 +62,11 @@ { title: content['Title'], abstract: content['Abstract'], synopsis: content['Synopsis'], file_name: content['Resource']&.dig('Name'), - pages: content['Resource']&.dig('Length').to_i + length: resource_length(content['Resource']) } end def asset_classes assets = @attrs.dig('Research', 'Product', 'Source', 'Organization', 'Expertise', 'AssetClasses', 'AssetClass') @@ -94,9 +94,14 @@ def current_status_info info = @attrs.dig('Research', 'Product', 'StatusInfo') info = [info] unless info.is_a? Array info.find { |status| status&.dig('currentStatusIndicator')&.downcase == 'yes' } || info.first + end + + def resource_length(resource) + length = resource&.dig('Length') + return length.to_i if length.respond_to?(:to_i) end def parse_info_from_author(author) person = author&.dig('Person') {