Class: RDoc::Generator::POT::PO

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/generator/pot/po.rb

Overview

Generates a PO format text

Instance Method Summary collapse

Constructor Details

#initialize ⇒ PO

Creates an object that represents PO format.



13
14
15
16
# File 'lib/rdoc/generator/pot/po.rb', line 13

def initialize
  @entries = {}
  add_header
end

Instance Method Details

#add(entry) ⇒ Object

Adds a PO entry to the PO.



21
22
23
24
25
26
27
# 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

#to_s ⇒ Object

Returns PO format text for the PO.



32
33
34
# File 'lib/rdoc/generator/pot/po.rb', line 32

def to_s
  sort_entries.map(&:to_s).join("\n")
end