Class: Translatomatic::ResourceFile::CSV

Inherits:
Base
  • Object
show all
Defined in:
lib/translatomatic/resource_file/csv.rb

Overview

CSV resource file

Instance Attribute Summary

Attributes inherited from Base

#locale, #path, #properties

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#create_variable, enabled?, #format, #get, #initialize, is_key_value?, #locale_path, #sentences, #set, supports_variable_interpolation?, #to_s, #type, #variable_regex

Constructor Details

This class inherits a constructor from Translatomatic::ResourceFile::Base

Class Method Details

.extensionsArray<String>

Returns File extensions supported by this resource file.

Returns:

  • (Array<String>)

    File extensions supported by this resource file



8
9
10
# File 'lib/translatomatic/resource_file/csv.rb', line 8

def self.extensions
  %w{csv}
end

Instance Method Details

#save(target = path, options = {}) ⇒ void

This method returns an undefined value.

Save the resource file.

Parameters:

  • target (Pathname) (defaults to: path)

    The destination path

  • options (Hash<Symbol, Object>) (defaults to: {})

    Output format options



13
14
15
16
17
18
19
# File 'lib/translatomatic/resource_file/csv.rb', line 13

def save(target = path, options = {})
  ::CSV.open(target, "wb") do |csv|
    @properties.each do |key, value|
      csv << [key, value]
    end
  end
end