rsinger-enhanced_marc 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/Changes +1 -0
  2. data/LICENSE +21 -0
  3. data/README +51 -0
  4. data/Rakefile +23 -0
  5. data/test/ts_enhanced_marc.rb +5 -0
  6. metadata +66 -0
data/Changes ADDED
@@ -0,0 +1 @@
1
+ 2009-08-07: Refactored to monkeypatch ruby-marc rather than replace it.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2007 Ross Singer
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 ADDED
@@ -0,0 +1,51 @@
1
+ Enhanced MARC is a set of classes, modules and methods that sit on top of ruby-marc (http://rubyforge.org/projects/marc) to help parse MARC records more easily and conveniently.
2
+ Installation:
3
+ gem sources -a http://gems.github.com
4
+ sudo gem install rsinger-enhanced-marc
5
+
6
+ Usage:
7
+
8
+ require 'enhanced_marc'
9
+
10
+ reader = MARC::Reader.new('marc.dat')
11
+
12
+ records = []
13
+
14
+ reader.each do | record |
15
+ records << record
16
+ end
17
+
18
+ >> records[0].class
19
+ => MARC::BookRecord
20
+
21
+ >> records[0].is_conference?
22
+ => false
23
+
24
+ >> records[0].is_manuscript?
25
+ => false
26
+
27
+ # Send a boolean true if you want human readable forms, rather than MARC codes.
28
+ >> records[0].literary_form(true)
29
+ => "Non-fiction"
30
+
31
+ >> records[0].nature_of_contents(true)
32
+ => ["Bibliography", "Catalog"]
33
+
34
+ >> records[1].class
35
+ => MARC::SoundRecord
36
+
37
+ >> records[1].composition_form(true)
38
+ => "Jazz"
39
+
40
+ >> records[2].class
41
+ => MARC::MapRecord
42
+
43
+ >> records[2].projection(true)
44
+ => ["Cylindrical", "Mercator"]
45
+
46
+ >> records[2].relief(true)
47
+ => ["Color"]
48
+
49
+
50
+
51
+
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ RUBY_ENHANCED_MARC_VERSION = '0.1'
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'rake/testtask'
6
+ require 'rake/rdoctask'
7
+ require 'rake/packagetask'
8
+ require 'rake/gempackagetask'
9
+
10
+ task :default => [:test]
11
+
12
+ Rake::TestTask.new('test') do |t|
13
+ t.libs << 'lib'
14
+ t.pattern = 'test/tc_*.rb'
15
+ t.verbose = true
16
+ t.ruby_opts = ['-r marc', '-r test/unit']
17
+ end
18
+
19
+ Rake::RDocTask.new('doc') do |rd|
20
+ rd.rdoc_files.include("enhanced_marc/**/*.rb")
21
+ rd.main = 'MARC::Record'
22
+ rd.rdoc_dir = 'doc'
23
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # local marc library gets tested
4
+ # not already installed one
5
+ $LOAD_PATH.unshift("enhanced_marc")
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rsinger-enhanced_marc
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.1"
5
+ platform: ruby
6
+ authors:
7
+ - Ross Singer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-07 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: marc
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: A set of enhancements to ruby-marc to make parsing MARC data easier
26
+ email: rossfsinger@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - Rakefile
35
+ - README
36
+ - Changes
37
+ - LICENSE
38
+ has_rdoc: true
39
+ homepage: http://github.com/rsinger/enhanced-marc/tree
40
+ licenses:
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.8.6
51
+ version:
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ requirements: []
59
+
60
+ rubyforge_project:
61
+ rubygems_version: 1.3.5
62
+ signing_key:
63
+ specification_version: 2
64
+ summary: A set of enhancements to ruby-marc to make parsing MARC data easier
65
+ test_files:
66
+ - test/ts_enhanced_marc.rb