Sha256: 5730fb88ab173b0b054f2fca680e446587b2635e168b055596b8b40d9215075d

Contents?: true

Size: 829 Bytes

Versions: 3

Compression:

Stored size: 829 Bytes

Contents

# encoding: utf-8

module Github
  module Validations
    module Presence

      # TODO: Rename this
      # Ensures that esential arguments are present before request is made
      #
      def _validate_presence_of(*params)
        case params
        when Hash
          raise Github::Error::Validations.new(params)
        when Array
          params.each do |param|
            raise ArgumentError, "parameter cannot be nil" if param.nil?
          end
        end
      end


      # Check if user or repository parameters are passed
      #
      def _validate_user_repo_params(user_name, repo_name)
        raise ArgumentError, "[user] parameter cannot be nil" if user_name.nil?
        raise ArgumentError, "[repo] parameter cannot be nil" if repo_name.nil?
      end

    end # Presence
  end # Validations
end # Github

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
github_api-0.7.0 lib/github_api/validations/presence.rb
github_api-0.6.5 lib/github_api/validations/presence.rb
github_api-0.6.4 lib/github_api/validations/presence.rb