Class: RDoc::Generator::POT::POEntry
- Inherits:
-
Object
- Object
- RDoc::Generator::POT::POEntry
- Defined in:
- lib/rdoc/generator/pot/po_entry.rb
Overview
A PO entry in PO
Instance Attribute Summary collapse
-
#extracted_comment ⇒ Object
readonly
The comment content extracted from source file.
-
#flags ⇒ Object
readonly
The flags of the PO entry.
-
#msgid ⇒ Object
readonly
The msgid content.
-
#msgstr ⇒ Object
readonly
The msgstr content.
-
#references ⇒ Object
readonly
The locations where the PO entry is extracted.
-
#translator_comment ⇒ Object
readonly
The comment content created by translator (PO editor).
Instance Method Summary collapse
-
#initialize(msgid, options = {}) ⇒ POEntry
constructor
Creates a PO entry for
msgid
. -
#merge(other_entry) ⇒ Object
Merges the PO entry with
other_entry
. -
#to_s ⇒ Object
Returns the PO entry in PO format.
Constructor Details
#initialize(msgid, options = {}) ⇒ POEntry
Creates a PO entry for msgid
. Other valus can be specified by options
.
28 29 30 31 32 33 34 35 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 28 def initialize msgid, = {} @msgid = msgid @msgstr = [:msgstr] || "" @translator_comment = [:translator_comment] @extracted_comment = [:extracted_comment] @references = [:references] || [] @flags = [:flags] || [] end |
Instance Attribute Details
#extracted_comment ⇒ Object (readonly)
The comment content extracted from source file
16 17 18 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 16 def extracted_comment @extracted_comment end |
#flags ⇒ Object (readonly)
The flags of the PO entry
22 23 24 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 22 def flags @flags end |
#msgid ⇒ Object (readonly)
The msgid content
7 8 9 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 7 def msgid @msgid end |
#msgstr ⇒ Object (readonly)
The msgstr content
10 11 12 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 10 def msgstr @msgstr end |
#references ⇒ Object (readonly)
The locations where the PO entry is extracted
19 20 21 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 19 def references @references end |
#translator_comment ⇒ Object (readonly)
The comment content created by translator (PO editor)
13 14 15 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 13 def translator_comment @translator_comment end |
Instance Method Details
#merge(other_entry) ⇒ Object
Merges the PO entry with other_entry
.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 55 def merge other_entry = { :extracted_comment => merge_string(@extracted_comment, other_entry.extracted_comment), :translator_comment => merge_string(@translator_comment, other_entry.translator_comment), :references => merge_array(@references, other_entry.references), :flags => merge_array(@flags, other_entry.flags), } self.class.new(@msgid, ) end |
#to_s ⇒ Object
Returns the PO entry in PO format.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 40 def to_s entry = '' entry << format_translator_comment entry << format_extracted_comment entry << format_references entry << format_flags entry << <<-ENTRY msgid #{(@msgid)} msgstr #{(@msgstr)} ENTRY end |