berkeley_library-marc 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +1 -1
- data/.idea/inspectionProfiles/Project_Default.xml +1 -0
- data/.idea/marc.iml +52 -50
- data/CHANGES.md +5 -0
- data/README.md +3 -0
- data/berkeley_library-marc.gemspec +1 -0
- data/lib/berkeley_library/marc/module_info.rb +1 -1
- data/lib/marc_extensions/record.rb +11 -1
- data/spec/marc_extensions/record_spec.rb +16 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c479c395bc201b47ebfc171b3ee402e5962a4111f618ee26473aeb6d689011d5
|
4
|
+
data.tar.gz: 3197dc1cfbc96c65a31f6528351ce1b39dbea33e8142245e7527c55342c98f26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6e8adff15efbc36fea120f03481c59cc451831c40447a06c0451733d6660fb0fb2766ca0955a7214b0b941f861421f7d1ccfbacc41d37b6f8a012b67bddea1d
|
7
|
+
data.tar.gz: 62cb9959145a7b8a490b2cc7fe88657e6ca26233dc9dde6a7f8b9ec146fb5303bb17bdabcc8c96da97ac408aa3d795c46aa9954fd49d757acf049bd7c5829897
|
data/.github/workflows/build.yml
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
<inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
|
12
12
|
<inspection_tool class="RubyCaseWithoutElseBlockInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
13
13
|
<inspection_tool class="RubyStringKeysInHashInspection" enabled="true" level="INFORMATION" enabled_by_default="true" />
|
14
|
+
<inspection_tool class="RubyUnnecessaryReturnStatement" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
14
15
|
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
15
16
|
<option name="processCode" value="true" />
|
16
17
|
<option name="processLiterals" value="true" />
|
data/.idea/marc.iml
CHANGED
@@ -10,57 +10,59 @@
|
|
10
10
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
11
|
<excludeFolder url="file://$MODULE_DIR$/artifacts" />
|
12
12
|
</content>
|
13
|
-
<orderEntry type="jdk" jdkName="RVM: ruby-2.7.
|
13
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-2.7.4" jdkType="RUBY_SDK" />
|
14
14
|
<orderEntry type="sourceFolder" forTests="false" />
|
15
|
-
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.
|
16
|
-
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.
|
17
|
-
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, RVM: ruby-2.7.
|
18
|
-
<orderEntry type="library" scope="PROVIDED" name="bundle-audit (v0.1.0, RVM: ruby-2.7.
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.14, RVM: ruby-2.7.
|
20
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler-audit (v0.
|
21
|
-
<orderEntry type="library" scope="PROVIDED" name="ci_reporter (v2.0.0, RVM: ruby-2.7.
|
22
|
-
<orderEntry type="library" scope="PROVIDED" name="ci_reporter_rspec (v1.0.0, RVM: ruby-2.7.
|
23
|
-
<orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.7.
|
24
|
-
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.5, RVM: ruby-2.7.
|
25
|
-
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, RVM: ruby-2.7.
|
26
|
-
<orderEntry type="library" scope="PROVIDED" name="docile (v1.4.0, RVM: ruby-2.7.
|
27
|
-
<orderEntry type="library" scope="PROVIDED" name="dotenv (v2.7.6, RVM: ruby-2.7.
|
28
|
-
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.15.
|
29
|
-
<orderEntry type="library" scope="PROVIDED" name="hashdiff (v1.0.1, RVM: ruby-2.7.
|
30
|
-
<orderEntry type="library" scope="PROVIDED" name="listen (v3.1.5, RVM: ruby-2.7.
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="marc (v1.
|
32
|
-
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.
|
33
|
-
<orderEntry type="library" scope="PROVIDED" name="parser (v3.0.2.0, RVM: ruby-2.7.
|
34
|
-
<orderEntry type="library" scope="PROVIDED" name="parslet (v2.0.0, RVM: ruby-2.7.
|
35
|
-
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.6, RVM: ruby-2.7.
|
36
|
-
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, RVM: ruby-2.7.
|
37
|
-
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.
|
38
|
-
<orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.11.0, RVM: ruby-2.7.
|
39
|
-
<orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.10.1, RVM: ruby-2.7.
|
40
|
-
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.1.1, RVM: ruby-2.7.
|
41
|
-
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.
|
42
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, RVM: ruby-2.7.
|
43
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.1, RVM: ruby-2.7.
|
44
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, RVM: ruby-2.7.
|
45
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, RVM: ruby-2.7.
|
46
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.2, RVM: ruby-2.7.
|
47
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.11.0, RVM: ruby-2.7.
|
48
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.
|
49
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.
|
50
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v2.
|
51
|
-
<orderEntry type="library" scope="PROVIDED" name="ruby-
|
52
|
-
<orderEntry type="library" scope="PROVIDED" name="ruby-
|
53
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
54
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
55
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
56
|
-
<orderEntry type="library" scope="PROVIDED" name="simplecov
|
57
|
-
<orderEntry type="library" scope="PROVIDED" name="simplecov-
|
58
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
59
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
60
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
61
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
62
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
63
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, RVM: ruby-2.7.4) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="bundle-audit (v0.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.14, RVM: ruby-2.7.4) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler-audit (v0.9.0.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="ci_reporter (v2.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="ci_reporter_rspec (v1.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.5, RVM: ruby-2.7.4) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, RVM: ruby-2.7.4) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="docile (v1.4.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="dotenv (v2.7.6, RVM: ruby-2.7.4) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.15.4, RVM: ruby-2.7.4) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="hashdiff (v1.0.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="listen (v3.1.5, RVM: ruby-2.7.4) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="marc (v1.1.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.21.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v3.0.2.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="parslet (v2.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.6, RVM: ruby-2.7.4) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.4) [gem]" level="application" />
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.11.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.10.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.1.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.4) [gem]" level="application" />
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
44
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
45
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
46
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
47
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.11.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
48
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.11.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.6.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
50
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v2.4.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
51
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-marc-spec (v0.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
52
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-prof (v0.17.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
53
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
54
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby_dep (v1.5.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
55
|
+
<orderEntry type="library" scope="PROVIDED" name="scrub_rb (v1.0.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
56
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.21.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
57
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.3, RVM: ruby-2.7.4) [gem]" level="application" />
|
58
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov-rcov (v0.2.3, RVM: ruby-2.7.4) [gem]" level="application" />
|
59
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov_json_formatter (v0.1.3, RVM: ruby-2.7.4) [gem]" level="application" />
|
60
|
+
<orderEntry type="library" scope="PROVIDED" name="thor (v1.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
61
|
+
<orderEntry type="library" scope="PROVIDED" name="typesafe_enum (v0.3.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
62
|
+
<orderEntry type="library" scope="PROVIDED" name="unf (v0.1.4, RVM: ruby-2.7.4) [gem]" level="application" />
|
63
|
+
<orderEntry type="library" scope="PROVIDED" name="unf_ext (v0.0.8, RVM: ruby-2.7.4) [gem]" level="application" />
|
64
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
65
|
+
<orderEntry type="library" scope="PROVIDED" name="webmock (v3.14.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
64
66
|
</component>
|
65
67
|
<component name="RakeTasksCache">
|
66
68
|
<option name="myRootTask">
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# BerkeleyLibrary::Marc
|
2
2
|
|
3
|
+
[![Build Status](https://github.com/BerkeleyLibrary/marc/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/BerkeleyLibrary/marc/actions/workflows/build.yml)
|
4
|
+
[![Gem Version](https://img.shields.io/gem/v/berkeley_library-marc.svg)](https://github.com/BerkeleyLibrary/marc/releases)
|
5
|
+
|
3
6
|
MARC-related utility code and opinionated extensions to [ruby-marc](https://github.com/ruby-marc/ruby-marc)
|
4
7
|
for the UC Berkeley Library.
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_dependency 'marc', '~> 1.0'
|
26
26
|
spec.add_dependency 'parslet', '~> 2.0'
|
27
|
+
spec.add_dependency 'ruby-marc-spec', '~> 0.1'
|
27
28
|
|
28
29
|
spec.add_development_dependency 'bundle-audit', '~> 0.1'
|
29
30
|
spec.add_development_dependency 'ci_reporter_rspec', '~> 1.0'
|
@@ -7,7 +7,7 @@ module BerkeleyLibrary
|
|
7
7
|
SUMMARY = 'MARC utilities for the UC Berkeley Library'.freeze
|
8
8
|
DESCRIPTION = 'A gem providing MARC-related utility code and extensions to ruby-marc for the UC Berkeley Library'.freeze
|
9
9
|
LICENSE = 'MIT'.freeze
|
10
|
-
VERSION = '0.2.
|
10
|
+
VERSION = '0.2.1'.freeze
|
11
11
|
HOMEPAGE = 'https://github.com/BerkeleyLibrary/marc'.freeze
|
12
12
|
end
|
13
13
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'marc'
|
2
|
+
require 'marc/spec'
|
2
3
|
require 'marc_extensions/field_map'
|
3
4
|
require 'marc_extensions/data_field'
|
4
5
|
|
@@ -58,7 +59,7 @@ module MARCExtensions
|
|
58
59
|
#
|
59
60
|
# @return [Hash<String, Array<MARC::DataField>>] a hash from tags to fields
|
60
61
|
def data_fields_by_tag
|
61
|
-
# noinspection RubyYardReturnMatch
|
62
|
+
# noinspection RubyYardReturnMatch,RubyMismatchedReturnType
|
62
63
|
each_data_field.with_object({}) { |df, t2df| (t2df[df.tag] ||= []) << df }
|
63
64
|
end
|
64
65
|
|
@@ -89,6 +90,15 @@ module MARCExtensions
|
|
89
90
|
cf_001 = self['001']
|
90
91
|
return cf_001.value if cf_001
|
91
92
|
end
|
93
|
+
|
94
|
+
# Apply the provided [MARCSpec](http://marcspec.github.io/MARCspec/marc-spec.html)
|
95
|
+
# query to this record.
|
96
|
+
#
|
97
|
+
# @param query_str [String] A MARCSpec query string
|
98
|
+
# @return [Array] an array of the results of the query
|
99
|
+
def spec(query_str)
|
100
|
+
MARC::Spec.find(query_str, self)
|
101
|
+
end
|
92
102
|
end
|
93
103
|
end
|
94
104
|
|
@@ -208,4 +208,20 @@ describe MARC::Record do
|
|
208
208
|
expect(cff.map(&:tag)).to eq(expected_tags)
|
209
209
|
end
|
210
210
|
end
|
211
|
+
|
212
|
+
describe :spec do
|
213
|
+
it 'returns the results of a MARCSpec query' do
|
214
|
+
query_str = '856$u{$y~\2}'
|
215
|
+
|
216
|
+
expected_result = marc_record
|
217
|
+
.fields('856')
|
218
|
+
.find { |df| df['y'] =~ /2/ }
|
219
|
+
.subfields.find { |sf| sf.code == 'u' }
|
220
|
+
|
221
|
+
results = marc_record.spec(query_str)
|
222
|
+
expect(results).to be_an(Array)
|
223
|
+
expect(results.size).to eq(1)
|
224
|
+
expect(results[0]).to eq(expected_result)
|
225
|
+
end
|
226
|
+
end
|
211
227
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkeley_library-marc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: marc
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ruby-marc-spec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundle-audit
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -336,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
336
350
|
- !ruby/object:Gem::Version
|
337
351
|
version: '0'
|
338
352
|
requirements: []
|
339
|
-
rubygems_version: 3.1.
|
353
|
+
rubygems_version: 3.1.4
|
340
354
|
signing_key:
|
341
355
|
specification_version: 4
|
342
356
|
summary: MARC utilities for the UC Berkeley Library
|