Class: PolyglotCli::IO::Locale
- Inherits:
-
Object
- Object
- PolyglotCli::IO::Locale
- Extended by:
- Helper::Terminal
- Defined in:
- lib/polyglot_cli/io/locale.rb
Class Method Summary collapse
- .path(locale_path, locale) ⇒ Object
- .read(locale_path, locale) ⇒ Object
- .write(locale_path, data) ⇒ Object
Methods included from Helper::Terminal
Class Method Details
.path(locale_path, locale) ⇒ Object
17 18 19 |
# File 'lib/polyglot_cli/io/locale.rb', line 17 def path(locale_path, locale) "#{Dir.pwd}/#{locale_path}/#{locale}.yml" end |
.read(locale_path, locale) ⇒ Object
12 13 14 15 |
# File 'lib/polyglot_cli/io/locale.rb', line 12 def read(locale_path, locale) prompt.say("Reading translations from #{path(locale_path, locale)}") YAML.load_file(path(locale_path, locale)) end |
.write(locale_path, data) ⇒ Object
7 8 9 10 |
# File 'lib/polyglot_cli/io/locale.rb', line 7 def write(locale_path, data) prompt.say("Writing translations to #{path(locale_path, data.keys[0])}") File.open(path(locale_path, data.keys[0]), 'w') { |f| YAML.dump(data, f) } end |