Sha256: 899cad408f65a9edb786f37cdeef63c13d5c2d4eca2c588fc59c3dcfe2e806c8
Contents?: true
Size: 714 Bytes
Versions: 16
Compression:
Stored size: 714 Bytes
Contents
module ModsDisplay class Geo < Field def fields return [] unless geo_extensions.present? extensions = geo_extensions.map(&method(:process_geo_extension)) [ ModsDisplay::Values.new( label: I18n.t('mods_display.geo_extension'), values: extensions ) ] end private def process_geo_extension(extension) rdf = Nokogiri::XML(extension.children.to_s) [ rdf.xpath('//format').text[/format=(.*)$/, 1], rdf.xpath('//type').text[/#(.*)$/, 1] ].compact.join('; ') end def geo_extensions @geo_values ||= @values.select do |value| displayLabel(value) =~ /^geo:?$/ end end end end
Version data entries
16 entries across 16 versions & 1 rubygems