• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orangelight / 0e37073d-109c-440c-949f-49d2aa86311b

18 Aug 2025 09:05PM UTC coverage: 0.482% (-94.9%) from 95.343%
0e37073d-109c-440c-949f-49d2aa86311b

push

circleci

web-flow
Replace per_page_options_for_select with custom component to avoid deprecation issue (#5186)

* Start creating new component to address deprecaton warning

* Replace per_page_options_for_select with custom component to avoid deprecation issue

Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

---------

Co-authored-by: Ryan Jensen <rj1044@princeton.edu>
Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

0 of 33 new or added lines in 1 file covered. (0.0%)

9374 existing lines in 213 files now uncovered.

47 of 9753 relevant lines covered (0.48%)

0.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/models/concerns/blacklight/document/dublin_core.rb
1
# frozen_string_literal: true
2

UNCOV
3
require 'builder'
×
4
# This module provide Dublin Core export based on the document's semantic values
UNCOV
5
module Blacklight
×
UNCOV
6
  module Document
×
UNCOV
7
    module DublinCore
×
UNCOV
8
      def self.extended(document)
×
9
        # Register our exportable formats
UNCOV
10
        Blacklight::Document::DublinCore.register_export_formats(document)
×
UNCOV
11
      end
×
12

UNCOV
13
      def self.register_export_formats(document)
×
UNCOV
14
        document.will_export_as(:xml)
×
UNCOV
15
        document.will_export_as(:dc_xml, 'text/xml')
×
UNCOV
16
        document.will_export_as(:oai_dc_xml, 'text/xml')
×
UNCOV
17
        document.will_export_as(:rdf_dc, 'text/xml')
×
UNCOV
18
      end
×
19

UNCOV
20
      def dublin_core_field_names
×
UNCOV
21
        %i[contributor coverage creator date description format
×
UNCOV
22
           identifier language publisher relation rights source
×
UNCOV
23
           subject title type]
×
UNCOV
24
      end
×
25

26
      # dublin core elements are mapped against the #dublin_core_field_names whitelist.
UNCOV
27
      def export_as_oai_dc_xml
×
UNCOV
28
        xml = Builder::XmlMarkup.new
×
UNCOV
29
        xml.tag!('oai_dc:dc',
×
UNCOV
30
                 'xmlns:oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/',
×
UNCOV
31
                 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
×
UNCOV
32
                 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
×
UNCOV
33
                 'xsi:schemaLocation' => %(http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd)) do
×
UNCOV
34
          to_semantic_values.select { |field, _values| dublin_core_field_name? field }.each do |field, values|
×
UNCOV
35
            Array.wrap(values).each do |v|
×
UNCOV
36
              xml.tag! "dc:#{field}", v
×
UNCOV
37
            end
×
UNCOV
38
          end
×
UNCOV
39
        end
×
UNCOV
40
        xml.target!
×
UNCOV
41
      end
×
42

UNCOV
43
      def export_as_rdf_dc
×
UNCOV
44
        xml = Builder::XmlMarkup.new
×
UNCOV
45
        xml.tag!('rdf:RDF',
×
UNCOV
46
                 'xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
×
UNCOV
47
                 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
×
UNCOV
48
                 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance') do
×
UNCOV
49
          xml.tag!('rdf:Description', 'rdf:about' => "https://catalog.princeton.edu/catalog/#{id}") do
×
UNCOV
50
            to_semantic_values.select { |field, _values| dublin_core_field_name? field }.each do |field, values|
×
UNCOV
51
              Array.wrap(values).each do |v|
×
UNCOV
52
                xml.tag! "dc:#{field}", v
×
UNCOV
53
              end
×
UNCOV
54
            end
×
UNCOV
55
          end
×
UNCOV
56
        end
×
UNCOV
57
        xml.target!
×
UNCOV
58
      end
×
59

UNCOV
60
      alias export_as_xml export_as_oai_dc_xml
×
UNCOV
61
      alias export_as_dc_xml export_as_oai_dc_xml
×
62

UNCOV
63
      private
×
64

UNCOV
65
        def dublin_core_field_name?(field)
×
UNCOV
66
          dublin_core_field_names.include? field.to_sym
×
UNCOV
67
        end
×
UNCOV
68
    end
×
UNCOV
69
  end
×
UNCOV
70
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc