Class: PhraseAppUpdater::LocaleFile::JSONFile
Constant Summary
collapse
- EXTENSION =
"json"
- PHRASEAPP_TYPE =
"nested_json"
Instance Attribute Summary
#content, #locale_name, #parsed_content
Class Method Summary
collapse
class_for_file_format, #filename, from_file_content, from_hash, load_directory, load_file, #to_s
Class Method Details
.dump(hash) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/phraseapp_updater/locale_file/json_file.rb', line 23
def dump(hash)
json = Oj.dump(hash, indent: ' ', space: ' ', object_nl: "\n", array_nl: "\n", mode: :strict)
json << "\n"
json
end
|
.extension ⇒ Object
31
32
33
|
# File 'lib/phraseapp_updater/locale_file/json_file.rb', line 31
def extension
EXTENSION
end
|
.load(content) ⇒ Object
17
18
19
20
21
|
# File 'lib/phraseapp_updater/locale_file/json_file.rb', line 17
def load(content)
Oj.load(content)
rescue Oj::ParseError => e
raise ArgumentError.new("Provided content was not valid JSON: #{e}")
end
|
.phraseapp_type ⇒ Object
35
36
37
|
# File 'lib/phraseapp_updater/locale_file/json_file.rb', line 35
def phraseapp_type
PHRASEAPP_TYPE
end
|