Class: Babelish::CSV2JSON

Inherits:
Csv2Base show all
Defined in:
lib/babelish/csv2json.rb

Instance Attribute Summary

Attributes inherited from Csv2Base

#comments_column, #csv_filename, #csv_separator, #default_lang, #excluded_states, #ignore_lang_path, #keys_column, #langs, #languages, #output_basename, #output_dir, #state_column

Instance Method Summary collapse

Methods inherited from Csv2Base

#comments, #convert, #create_file_from_path, #default_filepath, #get_row_format, #initialize, #keys, #process_value, #table, #write_content

Constructor Details

This class inherits a constructor from Babelish::Csv2Base

Instance Method Details

#extensionObject



17
18
19
# File 'lib/babelish/csv2json.rb', line 17

def extension
  "js"
end

#hash_to_output(content = {}) ⇒ Object



13
14
15
# File 'lib/babelish/csv2json.rb', line 13

def hash_to_output(content = {})
  return content.to_json
end

#language_filepaths(language) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/babelish/csv2json.rb', line 5

def language_filepaths(language)
  require 'pathname'
  filename = @output_basename || language.code
  filepath = Pathname.new("#{@output_dir}#{filename}.js")

  return filepath ? [filepath] : []
end