Sha256: f4b09da21bb7cd33adf7060ba53d37a0093b8d16622365378b9ccdf222056a6a

Contents?: true

Size: 349 Bytes

Versions: 2

Compression:

Stored size: 349 Bytes

Contents

# This module holds shared logic that doesn't really belong anywhere else in the
# gem.
module Docker::Util
  include Docker::Error

  def parse_json(body)
    JSON.parse(body) unless body.nil? || body.empty? || (body == 'null')
  rescue JSON::ParserError => ex
    raise UnexpectedResponseError, ex.message
  end

  module_function :parse_json
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docker-api-1.5.1 lib/docker/util.rb
docker-api-1.5.0 lib/docker/util.rb