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, #name, #parsed_content

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PhraseAppUpdater::LocaleFile

class_for_file_format, #initialize, #name_with_extension, #to_s

Constructor Details

This class inherits a constructor from PhraseAppUpdater::LocaleFile

Class Method Details

.from_hash(name, hash) ⇒ Object



8
9
10
# File 'lib/phraseapp_updater/locale_file/yaml_file.rb', line 8

def self.from_hash(name, hash)
  new(name, Psych.dump(hash))
end

Instance Method Details

#format_content!Object



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

def format_content!
end

#parse(content) ⇒ Object



12
13
14
15
16
# File 'lib/phraseapp_updater/locale_file/yaml_file.rb', line 12

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