lib/marcspec/marcfieldspec.rb in marcspec-0.2.1 vs lib/marcspec/marcfieldspec.rb in marcspec-0.5.0
- old
+ new
@@ -174,11 +174,13 @@
def marc_values r
fields = r.find_by_tag(@tag)
vals = []
fields.each do |f|
subvals = f.sub_values(@codes)
- vals << subvals.join(@joiner) if subvals.size > 0
+ subvals = subvals.join(@joiner) if subvals.size > 0 and (@codes.nil? or @codes.size > 1)
+ vals << subvals
end
+ vals.flatten!
return vals
end
def pretty_print pp
pp.pp eval(self.asPPString)