• 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/marc/ctx_builder.rb
1
# frozen_string_literal: true
UNCOV
2
require 'openurl/context_object'
×
3

UNCOV
4
module Blacklight
×
UNCOV
5
  module Marc
×
6
    # Create a generic OpenUrl ContextObject
UNCOV
7
    class CtxBuilder
×
UNCOV
8
      def initialize(document:, format:)
×
UNCOV
9
        @document = document
×
UNCOV
10
        @format = format
×
UNCOV
11
      end
×
12

UNCOV
13
      def build
×
UNCOV
14
        ctx.referent.set_format(genre)
×
UNCOV
15
        apply_metadata
×
UNCOV
16
        ctx
×
UNCOV
17
      end
×
18

UNCOV
19
      def ctx
×
UNCOV
20
        @ctx ||= OpenURL::ContextObject.new
×
UNCOV
21
      end
×
22

UNCOV
23
      private
×
24

UNCOV
25
        def apply_metadata
×
UNCOV
26
          mapping.each do |key, value|
×
UNCOV
27
            ctx.referent.set_metadata(key.to_s, value)
×
UNCOV
28
          end
×
UNCOV
29
          add_identifiers
×
UNCOV
30
        end
×
31

UNCOV
32
        def add_identifiers
×
UNCOV
33
          id = @document['id']
×
UNCOV
34
          ctx.referent.add_identifier("https://catalog.princeton.edu/catalog/#{id}")
×
UNCOV
35
          ctx.referrer.add_identifier('info:sid/catalog.princeton.edu:generator')
×
UNCOV
36
          ctx.referent.add_identifier("info:oclcnum/#{@document['oclc_s'].first}") unless @document['oclc_s'].nil?
×
UNCOV
37
          ctx.referent.add_identifier("info:lccn/#{@document['lccn_s'].first}") unless @document['lccn_s'].nil?
×
UNCOV
38
        end
×
39

UNCOV
40
        def mapping
×
UNCOV
41
          {
×
UNCOV
42
            genre:,
×
UNCOV
43
            title:,
×
UNCOV
44
            creator: author,
×
UNCOV
45
            pub: publisher,
×
UNCOV
46
            format: @format,
×
UNCOV
47
            issn:,
×
UNCOV
48
            isbn:,
×
UNCOV
49
            date:
×
UNCOV
50
          }
×
UNCOV
51
        end
×
52

UNCOV
53
        def author
×
UNCOV
54
          @document['author_citation_display']&.first
×
UNCOV
55
        end
×
56

UNCOV
57
        def date
×
UNCOV
58
          @document['pub_date_display']&.first
×
UNCOV
59
        end
×
60

UNCOV
61
        def genre
×
UNCOV
62
          @format == 'conference' ? @format : 'unknown'
×
UNCOV
63
        end
×
64

UNCOV
65
        def isbn
×
UNCOV
66
          @document['isbn_s']&.first
×
UNCOV
67
        end
×
68

UNCOV
69
        def issn
×
UNCOV
70
          @document['issn_s']&.first
×
UNCOV
71
        end
×
72

UNCOV
73
        def oclc
×
UNCOV
74
          @document['oclc_s']&.first
×
UNCOV
75
        end
×
76

UNCOV
77
        def lccn
×
UNCOV
78
          @document['lccn_s']&.first
×
UNCOV
79
        end
×
80

UNCOV
81
        def publisher
×
UNCOV
82
          @document['pub_citation_display']&.first
×
UNCOV
83
        end
×
84

85
        # Truncate titles to avoid overly long OpenURLs
UNCOV
86
        def title
×
UNCOV
87
          @document['title_citation_display']&.first&.truncate(250)
×
UNCOV
88
        end
×
UNCOV
89
    end
×
UNCOV
90
  end
×
UNCOV
91
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