• 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

40.91
/marc_to_solr/lib/uri_ark.rb
1
# Class modeling the ARK standard for URL's
2
# @see https://tools.ietf.org/html/draft-kunze-ark-18
3
class URI::ARK < URI::Generic
1✔
4
  attr_reader :nmah, :naan, :name
1✔
5

6
  ARK_REGEX = %r{://(.+)/ark:/(.+)/(.+)/?}
1✔
7
  PRINCETON_ARK_REGEX = %r{[/?]ark:/88435/(.+)/?}
1✔
8

9
  # Constructs an ARK from a URL
10
  # @param url [URI::Generic] the URL for the ARK resource
11
  # @return [URI::ARK] the ARK
12
  def self.parse(url:)
1✔
UNCOV
13
    url = URI.parse(url) unless url.is_a? URI::Generic
×
UNCOV
14
    build(
×
15
      scheme: url.scheme,
16
      userinfo: url.userinfo,
17
      host: url.host,
18
      port: url.port,
19
      registry: url.registry,
20
      path: url.path,
21
      opaque: url.opaque,
22
      query: url.query,
23
      fragment: url.fragment
24
    )
25
  end
26

27
  # Validates whether or not a URL is an ARK URL
28
  # @param uri [URI::Generic] a URL
29
  # @return [TrueClass, FalseClass]
30
  def self.princeton_ark?(url:)
1✔
UNCOV
31
    return false if url.to_s.start_with?('http:http:')
×
UNCOV
32
    return false unless PRINCETON_ARK_REGEX.match(url.to_s)
×
UNCOV
33
    return false unless ARK_REGEX.match(url.to_s)
×
34

UNCOV
35
    true
×
36
  end
37

38
  # Constructor
39
  def initialize(*arg)
1✔
UNCOV
40
    super(*arg)
×
UNCOV
41
    extract_components!
×
42
  end
43

44
  private
1✔
45

46
    # Extract the components from the ARK URL into member variables
47
    def extract_components!
1✔
UNCOV
48
      raise StandardError, "Invalid ARK URL using: #{self.to_s}" unless self.class.princeton_ark?(url: self)
×
49

UNCOV
50
      m = ARK_REGEX.match(self.to_s)
×
51

UNCOV
52
      @nmah = m[1]
×
UNCOV
53
      @naan = m[2]
×
UNCOV
54
      @name = m[3]
×
55
    end
56
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