• 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/services/decorator_service.rb
1
# frozen_string_literal: true
2

UNCOV
3
class DecoratorService
×
4
  # Decorator for SolrDocument Objects
UNCOV
5
  class SolrDocumentDecorator
×
6
    # Access the SolrDocument
7
    # @return [SolrDocument]
UNCOV
8
    attr_reader :document
×
9

10
    # Constructor
11
    # @param document [SolrDocument] the document
12
    # @param title_field [String] the field used for the title
13
    # @param display_fields [Array<String>] the fields displayed using the decorator
UNCOV
14
    def initialize(document:, title_field: 'title_display', vernacular_title_field: 'title_vern_display', display_fields: [])
×
UNCOV
15
      @document = document
×
16

UNCOV
17
      @title_field = title_field
×
UNCOV
18
      @vernacular_title_field = vernacular_title_field
×
UNCOV
19
      @display_fields = display_fields
×
UNCOV
20
    end
×
21

22
    # Retrieve a Hash containing fields as keys for field values
23
    # @return [Hash]
UNCOV
24
    def fields
×
UNCOV
25
      displayed_fields = @display_fields.select { |display_field| @document.key?(display_field) }
×
UNCOV
26
      pairs = displayed_fields.map do |display_field|
×
UNCOV
27
        [display_field, Array.wrap(@document.fetch(display_field))]
×
UNCOV
28
      end
×
UNCOV
29
      Hash[pairs]
×
UNCOV
30
    end
×
31

32
    # Access the title
33
    # @return [String]
UNCOV
34
    def title
×
UNCOV
35
      @document.fetch(@title_field, nil)
×
UNCOV
36
    end
×
37

UNCOV
38
    def vernacular_title
×
UNCOV
39
      @document.fetch(@vernacular_title_field, nil)
×
UNCOV
40
    end
×
41

42
    # Access the ID for the Solr Document
43
    # @return [String]
UNCOV
44
    def id
×
UNCOV
45
      @document.fetch('id')
×
UNCOV
46
    end
×
UNCOV
47
  end
×
UNCOV
48
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