frozen_string_literal: false

Generates a PO format text

Methods
A
N
T
Class Public methods
new()

Creates an object that represents PO format.

# File lib/rdoc/generator/pot/po.rb, line 10
def initialize
  @entries = {}
  add_header
end
Instance Public methods
add(entry)

Adds a PO entry to the PO.

# File lib/rdoc/generator/pot/po.rb, line 18
def add entry
  existing_entry = @entries[entry.msgid]
  if existing_entry
    entry = existing_entry.merge(entry)
  end
  @entries[entry.msgid] = entry
end
to_s()

Returns PO format text for the PO.

# File lib/rdoc/generator/pot/po.rb, line 29
def to_s
  po = ''
  sort_entries.each do |entry|
    po << "\n" unless po.empty?
    po << entry.to_s
  end
  po
end