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 values can be specified by options
.
29 30 31 32 33 34 35 36 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 29 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
17 18 19 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 17 def extracted_comment @extracted_comment end |
#flags ⇒ Object (readonly)
The flags of the PO entry
23 24 25 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 23 def flags @flags end |
#msgid ⇒ Object (readonly)
The msgid content
8 9 10 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 8 def msgid @msgid end |
#msgstr ⇒ Object (readonly)
The msgstr content
11 12 13 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 11 def msgstr @msgstr end |
#references ⇒ Object (readonly)
The locations where the PO entry is extracted
20 21 22 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 20 def references @references end |
#translator_comment ⇒ Object (readonly)
The comment content created by translator (PO editor)
14 15 16 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 14 def translator_comment @translator_comment end |
Instance Method Details
#merge(other_entry) ⇒ Object
Merges the PO entry with other_entry
.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 56 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.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rdoc/generator/pot/po_entry.rb', line 41 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 |