Sha256: 895a24dae7b0d48b9033d19d18413a5d8a4dd3ec851d9c9d8b944c9822f600fe
Contents?: true
Size: 646 Bytes
Versions: 7
Compression:
Stored size: 646 Bytes
Contents
module RDStation class Error class Format FLAT_HASH = 'FLAT_HASH'.freeze HASH_OF_ARRAYS = 'HASH_OF_ARRAYS'.freeze ARRAY_OF_HASHES = 'ARRAY_OF_HASHES'.freeze def initialize(errors) @errors = errors end def format return FLAT_HASH if flat_hash? return HASH_OF_ARRAYS if hash_of_arrays? ARRAY_OF_HASHES end private def flat_hash? return unless @errors.is_a?(Hash) @errors.key?('error_type') end def hash_of_arrays? @errors.is_a?(Hash) && @errors.values.all? { |error| error.is_a? Array } end end end end
Version data entries
7 entries across 7 versions & 1 rubygems