• 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

30.19
/marc_to_solr/lib/action_note_builder.rb
1
class ActionNoteBuilder
1✔
2
  attr_reader :record
1✔
3

4
  def initialize(record:)
1✔
UNCOV
5
    @record = record
×
6
  end
7

8
  def self.build(record:)
1✔
UNCOV
9
    new(record:).build
×
10
  end
11

12
  def build
1✔
UNCOV
13
    notes = []
×
14

UNCOV
15
    @record.fields('583').each do |field|
×
UNCOV
16
      public_note = field.indicator1 == '1'
×
UNCOV
17
      field_link = field['8']
×
UNCOV
18
      next unless public_note && (field_link.present? || pulfa_record? || scsb_record?)
×
19

UNCOV
20
      notes << { description: description(field), uri: uri(field) }
×
21
    end
UNCOV
22
    notes = [notes.to_json.to_s] if notes.present?
×
UNCOV
23
    notes.presence
×
24
  end
25

26
  private
1✔
27

28
    def description(field)
1✔
UNCOV
29
      description = ''
×
UNCOV
30
      description << materials_specified(field)
×
UNCOV
31
      description << action(field)
×
UNCOV
32
      description << action_interval(field)
×
UNCOV
33
      description << authorization_phrase(field)
×
UNCOV
34
      description << institution(field)
×
35
    end
36

37
    def uri(field)
1✔
UNCOV
38
      return '' if field['u'].blank?
×
39

UNCOV
40
      field['u'].strip
×
41
    end
42

43
    def action(field)
1✔
UNCOV
44
      return '' if field['a'].blank?
×
45

UNCOV
46
      field['a']&.upcase_first
×
47
    end
48

49
    def action_interval(field)
1✔
UNCOV
50
      return '' if field['d'].blank?
×
51

UNCOV
52
      " #{field['d']}"
×
53
    end
54

55
    def authorization_phrase(field)
1✔
UNCOV
56
      return '' if field['f'].blank?
×
57

UNCOV
58
      auth_array = authorization_array(field)
×
UNCOV
59
      auth_phrase = ''
×
UNCOV
60
      first_auth = auth_array.shift
×
UNCOV
61
      auth_phrase << " — #{first_auth}"
×
UNCOV
62
      auth_array.each do |auth|
×
UNCOV
63
        auth_phrase << " #{auth}"
×
64
      end
UNCOV
65
      auth_phrase
×
66
    end
67

68
    def authorization_array(field)
1✔
UNCOV
69
      field.subfields.select { |s_field| s_field.code == 'f' }.map(&:value)
×
70
    end
71

72
    def institution(field)
1✔
UNCOV
73
      return '' if field['5'].blank?
×
74

UNCOV
75
      " (#{field['5']})"
×
76
    end
77

78
    def materials_specified(field)
1✔
UNCOV
79
      return '' if field['3'].blank?
×
80

UNCOV
81
      "#{field['3']}: "
×
82
    end
83

84
    def pulfa_record?
1✔
UNCOV
85
      @pulfa_record ||= @record.fields('035').select { |f| f['a']&.downcase =~ /pulfa/ }.present?
×
86
    end
87

88
    def scsb_record?
1✔
UNCOV
89
      @scsb_record ||= scsb_doc?(@record['001']&.value)
×
90
    end
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