Class: Translatomatic::ResourceFile::XML
- Defined in:
- lib/translatomatic/resource_file/xml.rb
Overview
XML resource file
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.extensions ⇒ Array<String>
File extensions supported by this resource file.
Instance Method Summary collapse
-
#save(target = path, options = {}) ⇒ void
Save the resource file.
-
#set(key, value) ⇒ String
Set a property.
Methods inherited from Base
#create_variable, enabled?, #format, #get, #initialize, is_key_value?, #locale_path, #sentences, supports_variable_interpolation?, #to_s, #type, #variable_regex
Constructor Details
This class inherits a constructor from Translatomatic::ResourceFile::Base
Class Method Details
.extensions ⇒ Array<String>
Returns File extensions supported by this resource file.
6 7 8 |
# File 'lib/translatomatic/resource_file/xml.rb', line 6 def self.extensions %w{xml} end |
Instance Method Details
#save(target = path, options = {}) ⇒ void
This method returns an undefined value.
Save the resource file.
21 22 23 24 25 26 |
# File 'lib/translatomatic/resource_file/xml.rb', line 21 def save(target = path, = {}) if @doc add_created_by unless [:no_created_by] target.write(@doc.to_xml(indent: 2)) end end |
#set(key, value) ⇒ String
Set a property
11 12 13 14 15 16 17 18 |
# File 'lib/translatomatic/resource_file/xml.rb', line 11 def set(key, value) super(key, value) if @nodemap.include?(key) @nodemap[key].content = value else create_node(key, value) end end |