enhanced_marc 0.2.3 → 0.3.0

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.
@@ -1,7 +1,7 @@
1
1
  module VisualType
2
2
  include RecordType
3
- public :form, :audience_level, :is_govdoc?
4
-
3
+ public :form, :audience_level, :is_govdoc?, :govdoc?, :conference?
4
+
5
5
  def running_time
6
6
  if @record_type == 'VIS'
7
7
  unless self['008'].value[18,3] == 'nnn'
@@ -15,10 +15,10 @@ module VisualType
15
15
  return "Unknown" if fxd_fld.value[1,3] == "---"
16
16
  return fxd_fld.value[1,3].sub(/^0*/, '')
17
17
  end
18
- }
19
- return false
18
+ }
19
+ return false
20
20
  end
21
-
21
+
22
22
  def material_type(human_readable=false)
23
23
  tmat_map = {'a'=>'Art original', 'b'=>'Kit','c'=>'Art reproduction','d'=>'Diorama',
24
24
  'f'=>'Filmstrip','g'=>'Game','i'=>'Picture','k'=>'Graphic','l'=>'Technical drawing',
@@ -26,13 +26,13 @@ module VisualType
26
26
  'q'=>'Model','r'=>'Realia','s'=>'Slide','t'=>'Transparency','v'=>'Videorecording',
27
27
  'w'=>'Toy','z'=>'Other'}
28
28
  human_readable = tmat_map if human_readable
29
- return self.field_parser({:match=>'VIS', :start=>33,:end=>1}, {:match=>/[gkor]{1}/, :start=>16,:end=>1}, human_readable)
29
+ return self.field_parser({:match=>'VIS', :start=>33,:end=>1}, {:match=>/[gkor]{1}/, :start=>16,:end=>1}, human_readable)
30
30
  end
31
-
31
+
32
32
  def technique(human_readable=false)
33
33
  tech_map = {'a'=>'Animation','c'=>'Animation and live action','l'=>'Live action',
34
34
  'n'=>'N/A','u'=>'Unknown','z'=>'Other'}
35
35
  human_readable = tmat_map if human_readable
36
- return self.field_parser({:match=>'VIS', :start=>34,:end=>1}, {:match=>/[gkor]{1}/, :start=>17,:end=>1}, human_readable)
36
+ return self.field_parser({:match=>'VIS', :start=>34,:end=>1}, {:match=>/[gkor]{1}/, :start=>17,:end=>1}, human_readable)
37
37
  end
38
- end
38
+ end
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ 2009-08-07: Refactored to monkeypatch ruby-marc rather than replace it.
@@ -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.
@@ -1,7 +1,7 @@
1
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 the contents of MARC records more easily and conveniently.
2
2
  Installation:
3
- gem sources -a http://gemcutter.org
4
- sudo gem install enhanced_marc
3
+ gem sources -a http://gems.github.com
4
+ sudo gem install rsinger-enhanced_marc
5
5
 
6
6
  Usage:
7
7
 
@@ -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 CHANGED
@@ -1,64 +1,59 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: enhanced_marc
3
- version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 2
9
- - 3
10
- version: 0.2.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Ross Singer
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2010-09-24 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2010-09-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: marc
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
27
17
  - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
33
20
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: locale
37
21
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
41
24
  - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: locale
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
47
34
  type: :runtime
48
- version_requirements: *id002
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
49
41
  description: A set of enhancements to ruby-marc to make parsing MARC data easier
50
42
  email: rossfsinger@gmail.com
51
43
  executables: []
52
-
53
44
  extensions: []
54
-
55
- extra_rdoc_files:
45
+ extra_rdoc_files:
56
46
  - LICENSE
57
- - README
58
- files:
47
+ - README.md
48
+ files:
49
+ - ".editorconfig"
50
+ - ".gitignore"
51
+ - ".rspec"
52
+ - ".travis.yml"
59
53
  - Changes
54
+ - Gemfile
60
55
  - LICENSE
61
- - README
56
+ - README.md
62
57
  - Rakefile
63
58
  - VERSION
64
59
  - enhanced_marc.gemspec
@@ -84,41 +79,40 @@ files:
84
79
  - lib/enhanced_marc/sound_type.rb
85
80
  - lib/enhanced_marc/visual_record.rb
86
81
  - lib/enhanced_marc/visual_type.rb
87
- - lib/enhanced_marc/xmlreader.rb
82
+ - pkg/enhanced_marc-0.1.5.gem
83
+ - pkg/enhanced_marc-0.1.gem
84
+ - pkg/enhanced_marc-0.1.tgz
85
+ - pkg/enhanced_marc-0.1.zip
86
+ - pkg/enhanced_marc-0.1/Changes
87
+ - pkg/enhanced_marc-0.1/LICENSE
88
+ - pkg/enhanced_marc-0.1/README
89
+ - pkg/enhanced_marc-0.1/Rakefile
90
+ - pkg/enhanced_marc-0.1/test/ts_enhanced_marc.rb
88
91
  - test/ts_enhanced_marc.rb
89
- has_rdoc: true
90
92
  homepage: http://github.com/rsinger/enhanced-marc/tree
91
93
  licenses: []
92
-
94
+ metadata: {}
93
95
  post_install_message:
94
- rdoc_options:
95
- - --charset=UTF-8
96
- require_paths:
96
+ rdoc_options:
97
+ - "--charset=UTF-8"
98
+ require_paths:
97
99
  - lib
98
- required_ruby_version: !ruby/object:Gem::Requirement
99
- none: false
100
- requirements:
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
101
102
  - - ">="
102
- - !ruby/object:Gem::Version
103
- hash: 3
104
- segments:
105
- - 0
106
- version: "0"
107
- required_rubygems_version: !ruby/object:Gem::Requirement
108
- none: false
109
- requirements:
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
110
107
  - - ">="
111
- - !ruby/object:Gem::Version
112
- hash: 3
113
- segments:
114
- - 0
115
- version: "0"
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
116
110
  requirements: []
117
-
118
111
  rubyforge_project:
119
- rubygems_version: 1.3.7
112
+ rubygems_version: 2.4.5.1
120
113
  signing_key:
121
114
  specification_version: 3
122
115
  summary: A DSL for MARC data
123
- test_files:
116
+ test_files:
124
117
  - test/ts_enhanced_marc.rb
118
+ has_rdoc:
@@ -1,58 +0,0 @@
1
- module MARC
2
- class XMLReader
3
- # will accept parse events until a record has been built up
4
- #
5
- def build_record
6
- record = MARC::Record.new
7
- data_field = nil
8
- control_field = nil
9
- subfield = nil
10
- text = ''
11
- attrs = nil
12
-
13
- while @parser.has_next?
14
- event = @parser.pull
15
-
16
- if event.text?
17
- text += REXML::Text::unnormalize(event[0])
18
- next
19
- end
20
-
21
- if event.start_element?
22
- text = ''
23
- attrs = event[1]
24
- case strip_ns(event[0])
25
- when 'controlfield'
26
- text = ''
27
- control_field = MARC::ControlField.new(attrs['tag'])
28
- when 'datafield'
29
- text = ''
30
- data_field = MARC::DataField.new(attrs['tag'], attrs['ind1'],
31
- attrs['ind2'])
32
- when 'subfield'
33
- text = ''
34
- subfield = MARC::Subfield.new(attrs['code'])
35
- end
36
- end
37
-
38
- if event.end_element?
39
- case strip_ns(event[0])
40
- when 'leader'
41
- record.leader = text
42
- when 'record'
43
- return record
44
- when 'controlfield'
45
- control_field.value = text
46
- record.append(control_field)
47
- when 'datafield'
48
- record.append(data_field)
49
- when 'subfield'
50
- subfield.value = text
51
- data_field.append(subfield)
52
- end
53
- end
54
- end
55
- record.to_typed_record
56
- end
57
- end
58
- end