Module: Pubid::Rendering::Publisher

Included in:
Base
Defined in:
lib/pubid/rendering/publisher.rb

Instance Method Summary collapse

Instance Method Details

#render_publisher(publisher, copublishers = nil, **options) ⇒ String

Render publisher with optional copublishers

Parameters:

Returns:

  • (String)

    formatted publisher string



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pubid/rendering/publisher.rb', line 11

def render_publisher(publisher, copublishers = nil, **options)
  return "" unless publisher

  result = publisher.to_s

  if copublishers&.any?
    separator = options[:copublisher_separator] || "/"
    result += copublishers.map { |cp| "#{separator}#{cp}" }.join
  end

  result
end