Sha256: 2bddf76612dae44cac886423c9e5a7a8c707f0c25ff552222be0a5941d40d698

Contents?: true

Size: 651 Bytes

Versions: 6

Compression:

Stored size: 651 Bytes

Contents

# encoding: utf-8

module Github
  module Validations
    module Required

      # Validate all keys present in a provided hash against required set,
      # on mismatch raise Github::Error::RequiredParams
      # Note that keys need to be in the same format i.e. symbols or strings,
      # otherwise the comparison will fail.
      #
      def assert_required_keys(required, provided)
        result = required.all? do |key|
          provided.deep_key? key
        end
        if !result
          raise Github::Error::RequiredParams.new(provided, required)
        end
        result
      end

    end # Required
  end # Validations
end # Github

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
github_api-0.12.4 lib/github_api/validations/required.rb
github_api-0.12.3 lib/github_api/validations/required.rb
github_api-0.12.2 lib/github_api/validations/required.rb
github_api-0.12.1 lib/github_api/validations/required.rb
github_api-0.12.0 lib/github_api/validations/required.rb
github_api-0.11.3 lib/github_api/validations/required.rb