call_number_ranges 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2049e102ca3998497eb94a67a8cb6de4d0ff91e4c0cb113d7f7ae32ace9fbcdd
4
+ data.tar.gz: a1fb8effe7c13cc3668525a972cc190f205531d33448c007f77ac3b6931f3440
5
+ SHA512:
6
+ metadata.gz: aac087b77725073f2b106a5aafa65fb54de88fffac2ad019dabf0cec7ab8b9511e6654d7b93444eb1aabca508f6d3b7950015e928ccce6d42770ff2f14a2fb82
7
+ data.tar.gz: 0523bd846abb1c803751b9879015efb19def1a20ba99365fb9a4c73c7302f028b270c7d0f6c3617756913ace11f4ebee6b29fe62c29852ef86011fbd824f7a8c
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.6
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in call_number_ranges.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Jane Sandberg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # CallNumberRanges
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/call_number_ranges`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'call_number_ranges'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install call_number_ranges
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/call_number_ranges.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'call_number_ranges'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/call_number_ranges/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'call_number_ranges'
7
+ spec.version = CallNumberRanges::VERSION
8
+ spec.authors = ['Jane Sandberg']
9
+ spec.email = ['sandbej@linnbenton.edu']
10
+
11
+ spec.summary = 'Some mappings of Library of Congress call numbers to academic departments'
12
+ spec.description = <<-END_DESCRIPTION
13
+ Some mappings of Library of Congress call numbers to academic departments.
14
+ Very opinionated and specific to our specific context. See also the
15
+ high_level_browse gem.
16
+ END_DESCRIPTION
17
+ spec.homepage = 'https://github.com/lbcclib/call_number_ranges'
18
+ spec.license = 'MIT'
19
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
20
+
21
+ spec.metadata['homepage_uri'] = spec.homepage
22
+ spec.metadata['source_code_uri'] = 'https://github.com/lbcclib/call_number_ranges'
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ end
29
+ spec.bindir = 'exe'
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ['lib']
32
+
33
+ spec.add_development_dependency 'rspec', '~> 3.10'
34
+ spec.add_development_dependency 'rubocop', '~> 1.11'
35
+ end
@@ -0,0 +1,114 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'call_number_ranges/version'
4
+
5
+ DISCIPLINES = {
6
+ 'Accessibility' => Regexp.new('^(HV155[3-9]|HV15[6-9][0-9]|HV1[6-9][0-9]{2}|HV2[0-9]{3}|HV300[0-4]|'\
7
+ 'KF480|LC481[2-9]|LC48[2-9][0-9]|LC49[01][0-9]|LC492[0-8]|'\
8
+ 'NA2547|'\
9
+ 'RA440|RC553.A88|RC569\.[7-9]|RC57[0-4])'),
10
+ 'Accounting' => /^HF(56[0-9]{2})(\.|\s)/,
11
+ 'Agriculture' => Regexp.new('^(HD140[1-9]|HD14[1-9][0-9]|HD1[5-9][0-9]{2}|HD2[01][0-9]{2}|HD220[0-9]|HD2210|'\
12
+ 'S[0-9]+|SF1?[0-9]{,2}|SF2[0-48-9][0-9]|SF27[6-9]|'\
13
+ 'TJ148[0-9]|TJ149[0-6])'),
14
+ 'Anthropology' => /^(CC|GN|GR|GT|E[5-9][0-9](\.|\s)|PM[0-9]{1,3}(\.|\s)|PM[1-7][0-9]{3}(\.|\s))/,
15
+ 'Automotive technology' => /^TL(\.|\s)/,
16
+ 'Aviation science' => /^(TL[56][0-9]{2}|7[0-7][0-9]|78[0-5])(\.|\s)/,
17
+ 'Biology' => Regexp.new('^(GE[0-9]|'\
18
+ 'Q[12]?[0-9]{,2}(\.|\s)|QH[0-9]|QK[0-9]|QL[0-9]|QM[0-9]|QP[0-9]|QR[0-9]|'\
19
+ 'S59[0-9]|S6[0-5][0-9]|S66[0-7]|SB|SD|SH|'\
20
+ 'TP248\.1[3-9]|TP248\.[2-5]|TP248\.6[0-5])'),
21
+ 'Business' => /^(HB[0-9]|HC[0-9]|HD[0-9]|HE[0-9]|HF[0-9]|HG[0-9]|HJ[0-9])/,
22
+ 'Ceramics' => /^(NK3[7-9][0-9]{2}|NK4[0-5][0-9]{2}|NK46[0-8][0-9]|NK469[0-4]|TT919|TT92[0-7])(\.|\s)/,
23
+ 'Communication' => /^(GN345\.6|HM258|P8[7-9]|P9[0-6]|PN4[0-2][0-9]{2}|PN43[01][0-9]|PN432[01])(\.|\s)/,
24
+ 'Computer science' => Regexp.new('^(HD69\.P75|HF5548\.[45]|'\
25
+ 'Q3[3-9][0-9]|QA7[56]\.[5-9][0-9]*|QA16[4-9]|'\
26
+ 'T14\.5|T36|T57|T58\.[56][0-9]*|TJ211|TJ223|TK5105)(\.|\s)'),
27
+ 'Counseling' => /^(BF636|LB2343)(\.|\s)/,
28
+ 'Criminal justice' => Regexp.new('^(HV[678][0-9]{3}|HV9[0-8][0-9]{2}|HV99[01][0-9]|HV9920|'\
29
+ 'KF9[67][0-9]{2}|KF98[01][0-9]|KF982[0-7])'),
30
+ 'Culinary arts' => Regexp.new('^(SF2[56][0-9]|SF27[0-5]|'\
31
+ 'TP5[0-9]{2}|TP6[0-7][0-9]|TP68[0-4]|'\
32
+ 'TX(537|545|63[1-9]|6[4-9][0-9]|[78][0-9]{2}|9[0-4][0-9]|95[0-3]))'),
33
+ 'Dental assisting' => /^(RK[0-9]+|QM535)(\.|\s)/,
34
+ 'Developmental studies' => /^LB2331\.2/,
35
+ 'Diagnostic imaging' => /^RC78\.7/,
36
+ 'Drafting and engineering graphics' => /^(T35[1-9]|T36[0-9]|T37[01]|TA174)(\.|\s)/,
37
+ 'Earth sciences' => /^(Q[12]?[0-9]{,2}(\.|\s)|GE|QE|SD|SH|SK)/,
38
+ 'Education and HDFS' => Regexp.new('^(GN480|GT24[6-8][0-9]|GT2490|'\
39
+ 'HV699|HV[7-9][0-9]{2}|HV1[0-3][0-9]{2}|14[0-4][0-9]|'\
40
+ 'HQ75\.27|HQ75\.53|HQ77[789]|HQ78[01]|HQ79[3-9]|'\
41
+ 'L[ABC]?[0-9]+)(\.|\s)'),
42
+ 'Engineering' => /^(T[AJK][0-9]+|TP15[56])(\.|\s)/,
43
+ 'English and writing' => /^(LB2360|P[0-9EN-Z]|T11(\.|\s)|T11\.[0-5]|ZA3075)/,
44
+ 'English Language Acquisition' => Regexp.new('^(LB1572|LB1576|'\
45
+ 'P51|P11[89]|P12[01]|PE110[89]|PE111[0-4]|PE1128\.A2|PE113[1-9]|PE1404)'\
46
+ '(\.|\s)'),
47
+ 'Equine science' => /^SF3[0-9]{2}(\.|\s)/,
48
+ 'Equity, diversity, and inclusion' => Regexp.new('^(BF575\.P9|'\
49
+ 'E184\.A1|E185\.6|'\
50
+ 'GN345\.6|GN469|GN495\.8|'\
51
+ 'HF5549\.5\.A34|HF5549\.5\.M5|'\
52
+ 'HM146|HM671|'\
53
+ 'HN90\.(E4|M26|M84|P57|P6|S6)|'\
54
+ 'HT150[1-9]|HT151[0-9]|HT152[01]|'\
55
+ 'K3242|'\
56
+ 'LB237[56]|'\
57
+ 'LC19[1-9]|LC20[0-9]|LC21[0-3]|LC214\.[0-4]|LC214\.5[0-3]|'\
58
+ 'LC1099|LC1[1-9][0-9]{2}|LC[234][0-9]{3}|LC50[0-9]{2}|LC51[0-5][0-9])'\
59
+ '(\.|\s)'),
60
+ 'Film studies' => /^(PN199[3-8]|TR84[5-9]|TR8[5-9][0-9]|TR9[01][0-9]|TR92[0-3])(\.|\s)/,
61
+ 'Health, Human Performance, Athletics and PE' => Regexp.new('^(GV20[1-9]|GV2[1-9][0-9]|GV[3-9][0-9]{2}|'\
62
+ 'GV10[0-9]{2}|GV11[0-8][0-9]|GV119[0-8]|'\
63
+ 'RC12[0-3][0-9]|RC124[0-5])(\.|\s)'),
64
+ 'Health informatics' => /^R85[89]|R86[0-4](\.|\s)/,
65
+ 'Heavy equipment/diesel' => /^TJ(\.|\s)/,
66
+ 'History' => /^([CDEF][0-9]+)(\.|\s)/,
67
+ 'International admissions' => /^LB237[56]/,
68
+ 'Journalism' => /^PN(4699|4[7-9][0-9]{2}|5[0-5][0-9]{2}|56[0-5][0-9])/,
69
+ 'Machine tool' => /^(TJ11[89][0-9]|TJ1[012][0-9]{2}|TJ130[0-9]|TJ131[0-3])/,
70
+ 'Math' => /^(HA|QA[1-6]|QA7[0-5]|QA7[89]|QA[89])/,
71
+ 'Mechatronics' => /^(TJ163\.12|TK7875)/,
72
+ 'Medical assisting' => Regexp.new('^(HG937[1-9]|HG93[89][0-9]|QM[0-9]+|'\
73
+ 'R118|R123|R728\.8|'\
74
+ 'RA[1-9]|RA[1-9][0-9]|RA[123][0-9]{2}|RA40[0-9]|RA41[0-5]|'\
75
+ 'RC683.5.E5|RS[0-9]+)(\.|\s)'),
76
+ 'Music' => /^(M|ML|MT)[0-9]+/,
77
+ 'Non-destructive testing' => /^TA417\.[2-5]/,
78
+ 'Nursing' => Regexp.new('^((GN484\.38)|'\
79
+ '(QM|R[GST])[0-9]+|'\
80
+ 'QP([0-9]|[123][0-9]|4[01]|91|249|267|'\
81
+ '3[035][1-6]|32[1-9]|361|50[1-9]|51[0-8]|55[1-9]|5[6-9][0-9]|'\
82
+ '6[0-9]{2}|7[0-4][0-9]|75[0-2])(\.|\s))'),
83
+ 'Occupational therapy' => /^(BF71[2-9]|BF72[1-3]|BF724|QM[0-9]+|RM69[5-9]|RM[78][0-9]{2}|RM9[0-4][0-9]|RM950)(\.|\s)/,
84
+ 'Philosophy' => /^(B[0-9]+|BJ[1-9]|BJ[1-9][0-9]{1,2}|BJ1[0-5][0-9]{2}|BJ16[0-8][0-9]|BJ169[0-7])(\.|\s)/,
85
+ 'Physical sciences' => /^(Q[12]?[0-9]{,2}(\.|\s)|Q[BCD]?[0-9]+|TX545(\.|\s))/,
86
+ 'Polysomnographic technology' => /^(BF(106[89]|107[0-3])|QP42[5-7]|RA78[56]|RC54[7-9]|RC737\.5)(\.|\s)/,
87
+ 'Psychology' => /^(BF[0-9]+|R726\.[5-8]|RA785|RC32[1-9]|RC3[3-9][0-9]|RC4[0-9]{2}|RC5[0-6][0-9]|RC57[01])(\.|\s)/,
88
+ 'Public safety' => /^(HV8290|LB2866|QE53[1-9]|QE54[01])(\.|\s)/,
89
+ 'Religion' => Regexp.new('^(B[LMPQRSTVX][0-9]+|DS1[0-4][0-9]|KB[0-9]+|'\
90
+ 'LC32[1-9]|LC3[3-9][0-9]|LC[4-8][0-9]{2}|LC9[012][0-9])(\.|\s)'),
91
+ 'Small business' => /^(HD67\.2|HD2340\.[89]|HD234[0-5]|HD2346\.[0-5]|HF5679)/,
92
+ 'Sociology' => /^(E184|H[MNQSTV][0-9]+)/,
93
+ 'Spanish' => Regexp.new('^(PC407[3-9]|PC4[1-8][0-9]{2}|PC49[0-6][0-9]|PC497[01]|'\
94
+ 'PQ603[7-9]|PQ60[4-9][0-9]|PQ6[1-7][0-9]{2}|PQ8[0-4][0-9]{2}|PQ85[01][0-9])'),
95
+ 'Surgery' => /^(RD\n+|QM\n+|QR[1-9]|QR[1-6][0-9]|QR7[0-4]|R72[3-6])(\.|\s)/,
96
+ 'Visual arts' => /^(N[0-9]|NA|NB|NC|ND|NE|NK|NX|TR|TT919|TT92[0-7])/,
97
+ 'Visual communication' => /^(NC99[7-9]|NC100[0-3]|N7433\.8|NC915\.C65|NK15[2-4][0-9]|TK5105\.888|Z246|Z250)(\.|\s)/,
98
+ 'Water, Environment and Technology' => /^TD7(4[1-9]|[5-7][0-9]|80)(\.|\s)/,
99
+ 'Web technologies' => Regexp.new('(QA76\.76\s?\.H94|QA76\.73\s?\.J39|'\
100
+ 'QA76\.73\s?\.P224|QA76\.73\s?\.R83|QA76\.73\s?\.S67|'\
101
+ 'TK5105\.888)'),
102
+ 'Welding' => /^T(S21[5-9]|S22[0-8]|T211)(\.|\s)/,
103
+ "Women's studies" => /^HQ(11[1-9]|1[2-9][0-9]|[2-9][0-9]{2}|10[0-57-9][0-9]{2}|1[1-9][0-9]{2})(\.|\s)/
104
+ }.freeze
105
+
106
+ module CallNumberRanges
107
+ # Helpful if you have a call number, but want to see
108
+ # what disciplines match
109
+ class CallNumber
110
+ def self.disciplines(call_number)
111
+ DISCIPLINES.select { |_name, range| call_number.match? range }.keys
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CallNumberRanges
4
+ VERSION = '0.1.0'
5
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: call_number_ranges
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jane Sandberg
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-03-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ description: |2
42
+ Some mappings of Library of Congress call numbers to academic departments.
43
+ Very opinionated and specific to our specific context. See also the
44
+ high_level_browse gem.
45
+ email:
46
+ - sandbej@linnbenton.edu
47
+ executables: []
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - ".gitignore"
52
+ - ".rspec"
53
+ - ".travis.yml"
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - bin/console
59
+ - bin/setup
60
+ - call_number_ranges.gemspec
61
+ - lib/call_number_ranges.rb
62
+ - lib/call_number_ranges/version.rb
63
+ homepage: https://github.com/lbcclib/call_number_ranges
64
+ licenses:
65
+ - MIT
66
+ metadata:
67
+ homepage_uri: https://github.com/lbcclib/call_number_ranges
68
+ source_code_uri: https://github.com/lbcclib/call_number_ranges
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 2.4.0
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubygems_version: 3.0.3
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Some mappings of Library of Congress call numbers to academic departments
88
+ test_files: []