stanford-mods 0.0.14 → 0.0.15

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.
@@ -320,10 +320,16 @@ module Stanford
320
320
  # @return [String] value in the SearchWorks controlled vocabulary
321
321
  def format
322
322
  val=[]
323
- formats=self.term_values(:typeOfResource)
323
+ formats = self.term_values(:typeOfResource)
324
+ genres = self.term_values(:genre)
325
+ issuance = self.term_values([:origin_info,:issuance])
324
326
  if formats
325
327
  formats.each do |form|
326
328
  case form
329
+ when 'text'
330
+ val << 'Thesis' if genres and genres.include? 'thesis'
331
+ val << 'Book' if issuance and issuance.include? 'monographic'
332
+ val << 'Journal / Periodical' if issuance and issuance.include? 'continuing'
327
333
  when 'still image'
328
334
  val << 'Image'
329
335
  when 'mixed material'
@@ -1,6 +1,6 @@
1
1
  module Stanford
2
2
  module Mods
3
3
  # this is the Ruby Gem version
4
- VERSION = "0.0.14"
4
+ VERSION = "0.0.15"
5
5
  end
6
6
  end
@@ -589,6 +589,25 @@ describe "Searchworks mixin for Stanford::Mods::Record" do
589
589
  end
590
590
 
591
591
  context "format" do
592
+ it "should check genre as part of deciding format" do
593
+ m = "<mods #{@ns_decl}><typeOfResource>text</typeOfResouce><genre>thesis</genre></mods>"
594
+ @smods_rec = Stanford::Mods::Record.new
595
+ @smods_rec.from_str(m)
596
+ @smods_rec.format.should == ['Thesis']
597
+ end
598
+ it 'should work for datasets' do
599
+ m = "<mods #{@ns_decl}><typeOfResource>software, multimedia</typeOfResouce></mods>"
600
+ @smods_rec = Stanford::Mods::Record.new
601
+ @smods_rec.from_str(m)
602
+ @smods_rec.format.should == ['Computer File']
603
+ end
604
+ it 'should work for books' do
605
+ m = "<mods #{@ns_decl}><typeOfResource>text</typeOfResouce><originInfo><issuance>monographic</issueance></originInfo></mods>"
606
+ @smods_rec = Stanford::Mods::Record.new
607
+ @smods_rec.from_str(m)
608
+ @smods_rec.format.should == ['Book']
609
+ end
610
+
592
611
  it "should choose the format" do
593
612
  m = "<mods #{@ns_decl}><typeOfResource>still image</typeOfResouce></mods>"
594
613
  @smods_rec = Stanford::Mods::Record.new
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: 0.0.14
4
+ version: 0.0.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-04 00:00:00.000000000 Z
13
+ date: 2013-06-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mods
@@ -170,7 +170,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  segments:
172
172
  - 0
173
- hash: 823695280464572683
173
+ hash: -914844583045883292
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  none: false
176
176
  requirements:
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  segments:
181
181
  - 0
182
- hash: 823695280464572683
182
+ hash: -914844583045883292
183
183
  requirements: []
184
184
  rubyforge_project:
185
185
  rubygems_version: 1.8.25