Stanford::Mods
<img src=“https://secure.travis-ci.org/sul-dlss/stanford-mods.png?branch=master” alt=“Build Status” /> <img src=“https://gemnasium.com/sul-dlss/stanford-mods.png” alt=“Dependency Status” />
A Gem with Stanford specific wranglings of MODS (Metadata Object Description Schema) metadata from DOR, the Stanford Digital Object Repository.
Source code at github.com/sul-dlss/stanford-mods/
Generated API docs at rubydoc.info/github/sul-dlss/stanford-mods/
Installation
Add this line to your application’s Gemfile:
gem 'stanford-mods'
And then execute:
$ bundle
Or install it yourself as:
$ gem install stanford-mods
Usage
-
add stanford-mods to your gemfile
-
require ‘stanford-mods’
-
(I don’t think you will also need to require ‘mods’, but you might)
> m = Stanford::Mods::Record.new
> m.from_str('<mods><genre>ape</genre></mods>')
> m.genre
=> [#<Nokogiri::XML::Element:0x3fe07b48bb24 name=“genre” children=[#<Nokogiri::XML::Text:0x3fe07a09a7dc “ape”>]>] > m.genre.text => “ape”
> m.to_be_removed <-- method I wrote in stanford-mods for proof of concept
in foo!
=> nil
Example Using SearchWorks Mixins:
> require 'stanford-mods/searchworks'
> m = Stanford::Mods::Record.new > m.from_str(‘<mods><language><languageTerm authority=“iso639-2b” type=“code”>dut</languageTerm></language></mods>’) > m.language_facet <– from Searchworks mixin => [‘Dutch’] > m.languages <– from mods gem => [‘Dutch; Flemish’]
## Contributing
-
Fork it
-
Create your feature branch (‘git checkout -b my-new-feature`)
-
Write code and tests.
-
Commit your changes (‘git commit -am ’Added some feature’‘)
-
Push to the branch (‘git push origin my-new-feature`)
-
Create new Pull Request
Releases
-
0.0.11 escape regex special characters when using short title in a regex
-
0.0.10 get rid of ignore_me files
-
0.0.9 add sw_subject_names and sw_subject_titles methods to searchworks mixin
-
0.0.8 require stanford-mods/searchworks in stanford-mods (top level)
-
0.0.7 added sw_geographic_search to searchworks mixin
-
0.0.6 various title methods added to searchworks mixin
-
0.0.5 main_author_w_date, additional_authors_w_dates added to Stanford::Mods::Record; various author methods added to searchworks mixin
-
0.0.4 KolbRecord started
-
0.0.3 began SearchWorks mixins with sw_access_facet and sw_language_facet
-
0.0.2 add usage instructions to readme
-
0.0.1 Initial commit - grab name