Sha256: e02d622fd1881c8a321cce03acdec1083e8248da52310dea85603e2bb1682cd7

Contents?: true

Size: 509 Bytes

Versions: 2

Compression:

Stored size: 509 Bytes

Contents

require 'legion/json/version'
require 'legion/json/parse_error'
require 'multi_json'

module Legion
  module JSON
    class << self
      def parser
        @parser ||= MultiJson
      end

      def load(string, symbolize_keys = true)
        MultiJson.load(string, symbolize_keys: symbolize_keys)
      rescue StandardError => e
        raise Legion::JSON::ParseError.build(e, string)
      end

      def dump(object, pretty = false)
        parser.dump(object, pretty: pretty)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
legion-json-1.1.7 lib/legion/json.rb
legion-json-1.1.5 lib/legion/json.rb