Class: BabelishRnc::JSON2CSV

Inherits:
Base2Csv show all
Defined in:
lib/babelish_rnc/json2csv.rb

Instance Attribute Summary

Attributes inherited from Base2Csv

#csv_filename, #default_lang, #filenames, #headers

Instance Method Summary collapse

Methods inherited from Base2Csv

#convert

Constructor Details

#initialize(args = {:filenames => []}) ⇒ JSON2CSV

Returns a new instance of JSON2CSV.



5
6
7
# File 'lib/babelish_rnc/json2csv.rb', line 5

def initialize(args = {:filenames => []})
  super(args)
end

Instance Method Details

#load_strings(strings_filename) ⇒ Object

Raises:

  • (Errno::ENOENT)


9
10
11
12
13
14
15
16
17
# File 'lib/babelish_rnc/json2csv.rb', line 9

def load_strings(strings_filename)
  strings = {}
  raise Errno::ENOENT unless File.exist?(strings_filename)
  json_file = File.open(strings_filename, 'r')
  json_string = json_file.read
  json_file.close
  strings = JSON.parse(json_string).to_hash
  return strings
end