marc 0.4.3 → 0.4.4

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.
data/Changes CHANGED
@@ -1,3 +1,7 @@
1
+ v0.4.4 Sat Mar 03 14:55:00 EDT 2012
2
+ - Fixed performance regression: strict reader will parse about 5x faster now
3
+ - Updated CHANGES file for first time in a long time :-)
4
+
1
5
  v0.3.0 Wed Sep 23 21:51:00 EDT 2009
2
6
  - Nokogiri and jrexml parser integration added as well as Ruby 1.9 support
3
7
 
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- RUBY_MARC_VERSION = '0.4.3'
1
+ RUBY_MARC_VERSION = '0.4.4'
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rake'
@@ -149,7 +149,7 @@ module MARC
149
149
  end
150
150
 
151
151
 
152
- def codes(dedupe=true)
152
+ def codes(dedup=true)
153
153
  codes = []
154
154
  @subfields.each {|s| codes << s.code }
155
155
  dedup ? codes.uniq : codes
data/lib/marc/reader.rb CHANGED
@@ -89,7 +89,11 @@ module MARC
89
89
  # when operating in forgiving mode we just split on end of
90
90
  # field instead of using calculated byte offsets from the
91
91
  # directory
92
- all_fields = marc[base_address..-1].split(END_OF_FIELD)
92
+ if params[:forgiving]
93
+ all_fields = marc[base_address..-1].split(END_OF_FIELD)
94
+ else
95
+ mba = marc.bytes.to_a
96
+ end
93
97
 
94
98
  0.upto(num_fields-1) do |field_num|
95
99
 
@@ -116,7 +120,7 @@ module MARC
116
120
  offset = entry[7..11].to_i
117
121
  field_start = base_address + offset
118
122
  field_end = field_start + length - 1
119
- field_data = marc.bytes.to_a[field_start..field_end].pack("c*")
123
+ field_data = mba[field_start..field_end].pack("c*")
120
124
  end
121
125
 
122
126
  # remove end of field
data/test/t ADDED
@@ -0,0 +1 @@
1
+ # Logfile created on 2012-02-09 11:53:05 -0500 by logger.rb/31641
metadata CHANGED
@@ -1,15 +1,10 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: marc
3
- version: !ruby/object:Gem::Version
4
- hash: 9
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 3
10
- version: 0.4.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Kevin Clarke
14
9
  - Bill Dueber
15
10
  - William Groppe
@@ -18,19 +13,14 @@ authors:
18
13
  autorequire: marc
19
14
  bindir: bin
20
15
  cert_chain: []
21
-
22
- date: 2011-06-01 00:00:00 Z
16
+ date: 2012-03-05 00:00:00.000000000 Z
23
17
  dependencies: []
24
-
25
18
  description:
26
19
  email: ehs@pobox.com
27
20
  executables: []
28
-
29
21
  extensions: []
30
-
31
22
  extra_rdoc_files: []
32
-
33
- files:
23
+ files:
34
24
  - lib/marc/constants.rb
35
25
  - lib/marc/controlfield.rb
36
26
  - lib/marc/datafield.rb
@@ -54,6 +44,7 @@ files:
54
44
  - test/one.xml
55
45
  - test/random_tag_order.dat
56
46
  - test/random_tag_order2.dat
47
+ - test/t
57
48
  - test/tc_controlfield.rb
58
49
  - test/tc_datafield.rb
59
50
  - test/tc_dublincore.rb
@@ -72,38 +63,27 @@ files:
72
63
  - LICENSE
73
64
  homepage: http://marc.rubyforge.org/
74
65
  licenses: []
75
-
76
66
  post_install_message:
77
67
  rdoc_options: []
78
-
79
- require_paths:
68
+ require_paths:
80
69
  - lib
81
- required_ruby_version: !ruby/object:Gem::Requirement
70
+ required_ruby_version: !ruby/object:Gem::Requirement
82
71
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 59
87
- segments:
88
- - 1
89
- - 8
90
- - 6
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
91
75
  version: 1.8.6
92
- required_rubygems_version: !ruby/object:Gem::Requirement
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
77
  none: false
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- hash: 3
98
- segments:
99
- - 0
100
- version: "0"
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
101
82
  requirements: []
102
-
103
83
  rubyforge_project:
104
- rubygems_version: 1.8.1
84
+ rubygems_version: 1.8.15
105
85
  signing_key:
106
86
  specification_version: 3
107
87
  summary: A ruby library for working with Machine Readable Cataloging
108
- test_files:
88
+ test_files:
109
89
  - test/ts_marc.rb