2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/zcc/pickers.rb', line 2
def select_good_marc(take_how_many)
unless self[0].is_a? MARC::Record
raise ArgumentError, "This Array doesn't have a MARC::Record!" end
rec_copy = self.dup
recs_to_return = []
loop {
rec_copy.each_index do |index|
puts "#{index}\t#{rec_copy[index]['245']}"
puts "\t#{rec_copy[index]['300']}" if rec_copy[index]['300']
puts "\n\n"
end
if take_how_many =='one'
print "\nEnter # | s# | c#-# | l# | none : "
else
print "\nEnter # | n | s# | c#-# | l# | d : "
end
whichrec = STDIN.gets.chomp!
first_bit = whichrec[0,1]
puts "whichrec is an Integer" if whichrec.is_a?(Integer)
see_num = whichrec[1,9].to_i
if first_bit == 's'
puts rec_copy[see_num]
print "\n\nHit enter to continue."
STDIN.gets.chomp
next
elsif first_bit == 'c'
puts "comparison time!"
comparison = whichrec[1,99]
compare_nums = comparison.split('-')
rec_copy[compare_nums[0].to_i].compare_marc(rec_copy[compare_nums[1].to_i])
puts "\nHit enter to continue."
STDIN.gets
next
elsif first_bit == 'l'
rec_copy[whichrec[1,99].to_i].linter
puts "\nHit enter to continue."
STDIN.gets
next
elsif take_how_many == 'one'
if ( whichrec == 'none' )
puts "Since you cannot decide on a good record, please refer the book to a cataloger."
return "none"
elsif ( first_bit =~ /[a-z]/i or whichrec == '' )
puts "that's not a valid value. try again."
next
else
if whichrec.to_i > (rec_copy.length - 1)
puts "Your number exceeds the number of records in your retrieved set."
next
else
return recs_to_return << rec_copy[whichrec.to_i]
end
end
elsif take_how_many == 'multi'
if whichrec == 'd'
puts "You will not search any more zservers!"
recs_to_return << "done"
elsif ( whichrec == 'n' or whichrec == '' )
puts "recs that will be returned #{recs_to_return.length}"
return recs_to_return
elsif whichrec[0,1] =~ /[a-z]/i
puts "that's not a valid value. try again."
next
else
if whichrec.to_i > (rec_copy.length - 1)
puts "Your number exceeds the number of records in your retrieved set."
next
else
recs_to_return << rec_copy[whichrec.to_i]
next
end
end
else
puts "That's not a valid value take_how_many value to pass into select_good_marc!"
end
return recs_to_return
}
end
|