Class: PhraseAppUpdater::LocaleFile::YAMLFile

Inherits:
PhraseAppUpdater::LocaleFile show all
Defined in:
lib/phraseapp_updater/locale_file/yaml_file.rb

Constant Summary collapse

EXTENSION =
"yml"
PHRASEAPP_TYPE =
"yml"

Instance Attribute Summary

Attributes inherited from PhraseAppUpdater::LocaleFile

#content, #locale_name, #parsed_content

Class Method Summary collapse

Methods inherited from PhraseAppUpdater::LocaleFile

class_for_file_format, #filename, from_file_content, from_hash, load_directory, load_file, #to_s

Class Method Details

.dump(hash) ⇒ Object



15
16
17
# File 'lib/phraseapp_updater/locale_file/yaml_file.rb', line 15

def dump(hash)
  Psych.dump(hash)
end

.extensionObject



19
20
21
# File 'lib/phraseapp_updater/locale_file/yaml_file.rb', line 19

def extension
  EXTENSION
end

.load(content) ⇒ Object



9
10
11
12
13
# File 'lib/phraseapp_updater/locale_file/yaml_file.rb', line 9

def load(content)
  Psych.load(content)
rescue Psych::SyntaxError => e
  raise ArgumentError.new("Provided content was not valid YAML")
end

.phraseapp_typeObject



23
24
25
# File 'lib/phraseapp_updater/locale_file/yaml_file.rb', line 23

def phraseapp_type
  PHRASEAPP_TYPE
end