Class: Translatomatic::ResourceFile::Text
- Defined in:
- lib/translatomatic/resource_file/text.rb
Overview
Text 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.
Methods inherited from Base
#create_variable, enabled?, #get, #get_context, #initialize, key_value?, #locale_path, preferred_locale_separator, #properties, #properties=, #sentences, #set, supports_variable_interpolation?, #to_s, #type, #variable_regex
Methods included from PathUtils
#detect_path_locale, #modify_path_locale
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/text.rb', line 6 def self.extensions %w[txt text] end |
Instance Method Details
#save(target = path, options = {}) ⇒ void
This method returns an undefined value.
Save the resource file.
11 12 13 14 |
# File 'lib/translatomatic/resource_file/text.rb', line 11 def save(target = path, = {}) values = @properties.values.compact.collect { |i| i.strip + "\n" } target.write(values.join) end |