Skip to content

Commit

Permalink
Merge pull request #146 from sul-dlss/public-method
Browse files Browse the repository at this point in the history
Imprint.publisher_vals_str method made public for mods_display gem
  • Loading branch information
justinlittman authored Nov 30, 2023
2 parents 839b482 + 67c13fd commit c83be01
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/stanford-mods/imprint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ def dates(date_field_keys = [:dateIssued, :dateCreated, :dateCaptured, :copyrigh
end.compact.flatten
end

# called by mods_display gem, so made public
def publisher_vals_str
return if element.publisher.text.strip.empty?

publishers = element.publisher.reject do |p|
p.text.strip.empty?
end.map(&:text)
compact_and_join_with_delimiter(publishers, ' : ')
end

private

def compact_and_join_with_delimiter(values, delimiter)
Expand Down Expand Up @@ -73,15 +83,6 @@ def edition_vals_str
end.map(&:text).join(' ').strip
end

def publisher_vals_str
return if element.publisher.text.strip.empty?

publishers = element.publisher.reject do |p|
p.text.strip.empty?
end.map(&:text)
compact_and_join_with_delimiter(publishers, ' : ')
end

# PLACE processing methods ------

def place_vals_str
Expand Down

0 comments on commit c83be01

Please sign in to comment.