marc 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/marc/marc21.rb +2 -2
- data/lib/marc/record.rb +1 -1
- data/test/tc_record.rb +4 -4
- metadata +2 -2
data/lib/marc/marc21.rb
CHANGED
@@ -57,7 +57,7 @@ module MARC
|
|
57
57
|
marc[0..4] = sprintf("%05i", marc.length())
|
58
58
|
|
59
59
|
# store updated leader in the record that was passed in
|
60
|
-
record.leader = marc[0..LEADER_LENGTH]
|
60
|
+
record.leader = marc[0..LEADER_LENGTH-1]
|
61
61
|
|
62
62
|
# return encoded marc
|
63
63
|
return marc
|
@@ -68,7 +68,7 @@ module MARC
|
|
68
68
|
|
69
69
|
def decode(marc, params={})
|
70
70
|
record = Record.new()
|
71
|
-
record.leader = marc[0..LEADER_LENGTH]
|
71
|
+
record.leader = marc[0..LEADER_LENGTH-1]
|
72
72
|
|
73
73
|
# where the field data starts
|
74
74
|
base_address = record.leader[12..16].to_i
|
data/lib/marc/record.rb
CHANGED
data/test/tc_record.rb
CHANGED
@@ -24,17 +24,17 @@ class TestRecord < Test::Unit::TestCase
|
|
24
24
|
raw = IO.read('test/one.dat')
|
25
25
|
r = MARC::Record::new_from_marc(raw)
|
26
26
|
assert_equal(r.class, MARC::Record)
|
27
|
-
assert_equal(r.leader,'00755cam 22002414a
|
27
|
+
assert_equal(r.leader,'00755cam 22002414a 4500')
|
28
28
|
assert_equal(r.fields.length(), 18)
|
29
29
|
assert_equal(r.find {|f| f.tag == '245'}.to_s,
|
30
30
|
'245 10 $aActivePerl with ASP and ADO /$cTobias Martinsson.')
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def test_decode_forgiving
|
34
34
|
raw = IO.read('test/one.dat')
|
35
|
-
r = MARC::Record::new_from_marc(raw, :
|
35
|
+
r = MARC::Record::new_from_marc(raw, :forgiving => true)
|
36
36
|
assert_equal(r.class, MARC::Record)
|
37
|
-
assert_equal(r.leader,'00755cam 22002414a
|
37
|
+
assert_equal(r.leader,'00755cam 22002414a 4500')
|
38
38
|
assert_equal(r.fields.length(), 18)
|
39
39
|
assert_equal(r.find {|f| f.tag == '245'}.to_s,
|
40
40
|
'245 10 $aActivePerl with ASP and ADO /$cTobias Martinsson.')
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: marc
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2005-10-
|
6
|
+
version: 0.0.4
|
7
|
+
date: 2005-10-18 00:00:00 -05:00
|
8
8
|
summary: A ruby library for working with Machine Readable Cataloging
|
9
9
|
require_paths:
|
10
10
|
- lib
|