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

pulibrary / bibdata / 1dcebae2-3318-4e77-bc53-82276e293354

02 May 2025 04:45PM UTC coverage: 28.256% (-63.9%) from 92.189%
1dcebae2-3318-4e77-bc53-82276e293354

push

circleci

sandbergja
Add basic infrastructure for compiling rust code

* Add a rake compile task to compile
* Run the rake task in CI
* Run the rake task before rspec tests with the rust tag, to provide quick feedback on rust changes in TDD cycles

2 of 7 new or added lines in 2 files covered. (28.57%)

2467 existing lines in 97 files now uncovered.

1089 of 3854 relevant lines covered (28.26%)

0.29 hits per line

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

34.78
/app/models/electronic_location.rb
1
# Model for electronic location (MARC 856) fields
2
# @see https://www.loc.gov/marc/bibliographic/bd856.html
3
class ElectronicLocation
1✔
4
  # Constructor
5
  # @param access_method [String] code for the access method
6
  # @param relationship [String] code for the relationship
7
  # @param subfields [Array<Hash>] subfield Hashes
8
  # @param holdings [Array<Holding>] holding values
9
  # @param iiif_manifest_uris [Array<IIIFManifestURI>] IIIF manifests
10
  def initialize(access_method:, relationship:, subfields:, holdings:, iiif_manifest_uris:)
1✔
UNCOV
11
    @access_method = access_method
×
UNCOV
12
    @relationship = relationship
×
UNCOV
13
    @subfields = subfields
×
UNCOV
14
    index_holdings!(holdings)
×
UNCOV
15
    @manifests = iiif_manifest_uris.map(&:to_s)
×
UNCOV
16
    @iiif_manifest_uris = iiif_manifest_uris
×
17
  end
18

19
  # Returns the subfield value containing an ARK URL
20
  # @return [Array<String>] the ARK URLs
21
  def identifiers
1✔
UNCOV
22
    iiif_manifest_arks + @subfields.select do |subfield|
×
UNCOV
23
      subfield.key?(ElectronicLocations::SubfieldCodes::URI) && /arks\.princeton\.edu/.match(subfield[ElectronicLocations::SubfieldCodes::URI])
×
UNCOV
24
    end.map { |subfield| subfield[ElectronicLocations::SubfieldCodes::URI] }
×
25
  end
26

27
  def uri
1✔
28
    @subfields.flat_map { |x| x['u'] }.compact.first
×
29
  end
30

31
  def label
1✔
32
    @subfields.flat_map { |x| x['y'] }.compact.first || uri
×
33
  end
34

35
  private
1✔
36

37
    def iiif_manifest_arks
1✔
UNCOV
38
      @iiif_manifest_arks ||= @iiif_manifest_uris.map(&:ark).map(&:to_s)
×
39
    end
40

41
    # Index the electronic locations by labels
42
    # @param holdings [Holding] an array of electronic holdings
43
    # @param [Hash] Hash of Holdings indexed by their identifiers
44
    def index_holdings!(holdings)
1✔
UNCOV
45
      @holdings = {}
×
UNCOV
46
      holdings.each do |holding|
×
UNCOV
47
        @holdings[holding.id] = holding.to_s
×
48
      end
49
    end
50
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