Module: I18n::Tasks::Data::FileFormats

Included in:
FileSystemBase
Defined in:
lib/i18n/tasks/data/file_formats.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
# File 'lib/i18n/tasks/data/file_formats.rb', line 9

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#adapter_dump(tree, format) ⇒ Object



13
14
15
# File 'lib/i18n/tasks/data/file_formats.rb', line 13

def adapter_dump(tree, format)
  adapter_op :dump, format, tree, write_config(format)
end

#adapter_op(op, format, tree, config) ⇒ Object



22
23
24
25
26
# File 'lib/i18n/tasks/data/file_formats.rb', line 22

def adapter_op(op, format, tree, config)
  self.class.adapter_by_name(format).send(op, tree, config)
rescue Exception => e # rubocop:disable Lint/RescueException
  raise CommandError, "#{format} #{op} error: #{e.message}"
end

#adapter_parse(tree, format) ⇒ Hash

Returns:

  • (Hash)


18
19
20
# File 'lib/i18n/tasks/data/file_formats.rb', line 18

def adapter_parse(tree, format)
  adapter_op :parse, format, tree, read_config(format)
end