Sha256: ce6364e61347f39717628b818a72d784bd2014f411401628c90362cf01615a95

Contents?: true

Size: 511 Bytes

Versions: 4

Compression:

Stored size: 511 Bytes

Contents

# frozen_string_literal: true
require 'json'

module I18n::Tasks
  module Data
    module Adapter
      module JsonAdapter
        extend self

        # @return [Hash] locale tree
        def parse(str, opts)
          JSON.parse(str, parse_opts(opts))
        end

        # @return [String]
        def dump(tree, opts)
          JSON.generate(tree, parse_opts(opts))
        end

        private
        def parse_opts(opts)
          opts.try(:symbolize_keys) || {}
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
i18n-tasks-0.9.6 lib/i18n/tasks/data/adapter/json_adapter.rb
i18n-tasks-0.9.5 lib/i18n/tasks/data/adapter/json_adapter.rb
i18n-tasks-0.9.4 lib/i18n/tasks/data/adapter/json_adapter.rb
i18n-tasks-0.9.3 lib/i18n/tasks/data/adapter/json_adapter.rb