class RDoc::Generator::POT::PO

Generates a PO format text

Public Class Methods

Creates an object that represents PO format.

# File lib/rdoc/generator/pot/po.rb, line 13
def initialize
  @entries = {}
  add_header
end

Public Instance Methods

Adds a PO entry to the PO.

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

Returns PO format text for the PO.

# File lib/rdoc/generator/pot/po.rb, line 32
def to_s
  sort_entries.map(&:to_s).join("\n")
end