stanford-mods 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fda4f5ab13e13c81db05b27fd3ca5e5e17be0e1d
4
- data.tar.gz: 13a2ee552756a2e700ee102ada1b56b55d5cda82
3
+ metadata.gz: 11796d64d376478c428312bdf13efbaf2288a714
4
+ data.tar.gz: 76245b5148f0e271be3ca4bcb5dbf4fcc56a8528
5
5
  SHA512:
6
- metadata.gz: 63c3efbf88ea9d76b80182c490cb01c3d6d404858ce7d91f46b1d98c3df284cf8dad19cf6b55eb2185a1779bafd8c750dde4e04cf39e64f6c810cf030cc80359
7
- data.tar.gz: 275a160cf3603693e5801f0d5ff530995463c00a5f77625391fc09efaca8b13f0621f5a2e5034de5e1ae9cbb27d7a59fa0dcaf53aac877d057e65e004ecc3627
6
+ metadata.gz: 09e59c5d3aee8dd4197d93e885855adafd0b1bca74c151ad5016a59fe4acc9287bc485d17b0be22b36475290c0e2c9579526bfa74604e6462ffb94812e7ec99a
7
+ data.tar.gz: 61e33764cf9b580cafe08bd4a3dce60840f81e39e982bdb2693fe6d244a089947b97f840427064604c59ac9aa85a2b3d64983a29eaa4ea2b2d42fa32ef78f6da
@@ -14,7 +14,7 @@ module Stanford
14
14
  def as_envelope
15
15
  return unless valid?
16
16
 
17
- "ENVELOPE(#{bounds[:min_x]}, #{bounds[:max_x]}, #{bounds[:min_y]}, #{bounds[:max_y]})"
17
+ "ENVELOPE(#{bounds[:min_x]}, #{bounds[:max_x]}, #{bounds[:max_y]}, #{bounds[:min_y]})"
18
18
  end
19
19
 
20
20
  # Convert the coordinate to a Solr 4.x bbox-format representation
@@ -351,6 +351,21 @@ module Stanford
351
351
  val.delete 'Conference publication'
352
352
  end
353
353
  end
354
+ gov_pub = ['government publication', 'Government publication', 'Government Publication']
355
+ if !(genres & gov_pub).empty?
356
+ types = self.term_values(:typeOfResource)
357
+ if types && types.include?('text')
358
+ val << 'Government document'
359
+ val.delete 'Government publication'
360
+ end
361
+ end
362
+ tech_rpt = ['technical report', 'Technical report', 'Technical Report']
363
+ if !(genres & tech_rpt).empty?
364
+ types = self.term_values(:typeOfResource)
365
+ if types && types.include?('text')
366
+ val << 'Technical report'
367
+ end
368
+ end
354
369
  end
355
370
  val.uniq
356
371
  end
@@ -1,6 +1,6 @@
1
1
  module Stanford
2
2
  module Mods
3
3
  # this is the Ruby Gem version
4
- VERSION = "1.5.0"
4
+ VERSION = "1.5.1"
5
5
  end
6
6
  end
@@ -79,7 +79,7 @@ describe "Cartographic coordinates" do
79
79
  end
80
80
  it "returns decimal representation of latitude and longitude" do
81
81
  smods_rec.from_str(with_coords)
82
- expect(smods_rec.coordinates_as_envelope).to eq(["ENVELOPE(-16.0, 28.0, -15.0, 13.0)"])
82
+ expect(smods_rec.coordinates_as_envelope).to eq(["ENVELOPE(-16.0, 28.0, 13.0, -15.0)"])
83
83
  end
84
84
  end
85
85
  end # describe Cartographic coordinates
@@ -60,15 +60,15 @@ describe Stanford::Mods::Coordinate do
60
60
  context '#as_envelope' do
61
61
  {
62
62
  %((W 123°23ʹ16ʺ--W 122°31ʹ22ʺ/N 39°23ʹ57ʺ--N 38°17ʹ53ʺ)) =>
63
- 'ENVELOPE(-123.38777777777779, -122.52277777777778, 38.29805555555556, 39.399166666666666)',
63
+ 'ENVELOPE(-123.38777777777779, -122.52277777777778, 39.399166666666666, 38.29805555555556)',
64
64
  %(E 10°03'00"--E 12°58'00"/N 45°00'00"--N 41°46'00") =>
65
- 'ENVELOPE(10.05, 12.966666666666667, 41.766666666666666, 45.0)',
65
+ 'ENVELOPE(10.05, 12.966666666666667, 45.0, 41.766666666666666)',
66
66
  %(E 8°41'-E 12°21'/N 46°04'-N 44°23') =>
67
- 'ENVELOPE(8.683333333333334, 12.35, 44.38333333333333, 46.06666666666667)',
67
+ 'ENVELOPE(8.683333333333334, 12.35, 46.06666666666667, 44.38333333333333)',
68
68
  %((E17°--E11°/N14°--N18°).) =>
69
- 'ENVELOPE(11.0, 17.0, 14.0, 18.0)', # coordinates need to be reordered
69
+ 'ENVELOPE(11.0, 17.0, 18.0, 14.0)', # coordinates need to be reordered
70
70
  %((W 170⁰--E 55⁰/N 40⁰--S 36⁰).) =>
71
- 'ENVELOPE(-170.0, 55.0, -36.0, 40.0)', # superscript 0 is almost a degree character..
71
+ 'ENVELOPE(-170.0, 55.0, 40.0, -36.0)', # superscript 0 is almost a degree character..
72
72
  %((W 0°-W 0°/S 90°---S 90°)) =>
73
73
  'ENVELOPE(-0.0, -0.0, -90.0, -90.0)' # one dash, two dashes, three dashes.. what's the difference?
74
74
  }.each do |value, expected|
@@ -588,6 +588,34 @@ describe "Format fields (searchworks.rb)" do
588
588
  @smods_rec.from_str(m)
589
589
  expect(@smods_rec.sw_genre).to eq ['Thesis/Dissertation']
590
590
  end
591
+ it "Government Document: typeOfResource 'text', genre 'government publication'" do
592
+ m = "<mods #{@ns_decl}><genre authority=\"marcgt\">government publication</genre><typeOfResource>text</typeOfResource></mods>"
593
+ @smods_rec.from_str(m)
594
+ expect(@smods_rec.sw_genre).to eq ['Government document']
595
+ m = "<mods #{@ns_decl}><genre authority=\"marcgt\">Government publication</genre><typeOfResource>text</typeOfResource></mods>"
596
+ @smods_rec.from_str(m)
597
+ expect(@smods_rec.sw_genre).to eq ['Government document']
598
+ m = "<mods #{@ns_decl}><genre authority=\"marcgt\">Government Publication</genre><typeOfResource>text</typeOfResource></mods>"
599
+ @smods_rec.from_str(m)
600
+ expect(@smods_rec.sw_genre).to eq ['Government document']
601
+ m = "<mods #{@ns_decl}><genre>government publication</genre><typeOfResource>text</typeOfResource></mods>"
602
+ @smods_rec.from_str(m)
603
+ expect(@smods_rec.sw_genre).to eq ['Government document']
604
+ end
605
+ it "Technical Report: typeOfResource 'text', genre 'technical report'" do
606
+ m = "<mods #{@ns_decl}><genre authority=\"marcgt\">technical report</genre><typeOfResource>text</typeOfResource></mods>"
607
+ @smods_rec.from_str(m)
608
+ expect(@smods_rec.sw_genre).to eq ['Technical report']
609
+ m = "<mods #{@ns_decl}><genre authority=\"marcgt\">Technical report</genre><typeOfResource>text</typeOfResource></mods>"
610
+ @smods_rec.from_str(m)
611
+ expect(@smods_rec.sw_genre).to eq ['Technical report']
612
+ m = "<mods #{@ns_decl}><genre authority=\"marcgt\">Technical Report</genre><typeOfResource>text</typeOfResource></mods>"
613
+ @smods_rec.from_str(m)
614
+ expect(@smods_rec.sw_genre).to eq ['Technical report']
615
+ m = "<mods #{@ns_decl}><genre>technical report</genre><typeOfResource>text</typeOfResource></mods>"
616
+ @smods_rec.from_str(m)
617
+ expect(@smods_rec.sw_genre).to eq ['Technical report']
618
+ end
591
619
  it "capitalizes the first letter of a genre value" do
592
620
  m = "<mods #{@ns_decl}><genre authority=\"marcgt\">student project report</genre></mods>"
593
621
  @smods_rec.from_str(m)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stanford-mods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-27 00:00:00.000000000 Z
12
+ date: 2016-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mods
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  requirements: []
167
167
  rubyforge_project:
168
- rubygems_version: 2.4.5.1
168
+ rubygems_version: 2.4.8
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: Stanford specific wrangling of MODS metadata