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

pulibrary / orangelight / 00dbc10b-d747-4ad7-b211-7b26d753abbb

14 Aug 2025 01:25PM UTC coverage: 0.483% (-94.9%) from 95.343%
00dbc10b-d747-4ad7-b211-7b26d753abbb

push

circleci

web-flow
Merge pull request #5181 from pulibrary/dependabot/bundler/activestorage-7.2.2.2

Bump activestorage from 7.2.2.1 to 7.2.2.2

47 of 9721 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

3
class DecoratorService
×
4
  # Decorator for SolrDocument Objects
5
  class SolrDocumentDecorator
×
6
    # Access the SolrDocument
7
    # @return [SolrDocument]
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
14
    def initialize(document:, title_field: 'title_display', vernacular_title_field: 'title_vern_display', display_fields: [])
×
15
      @document = document
×
16

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

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

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

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

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