A mixin to help validate presence of non-empty values
Ensure that esential arguments are present before request is made.
Hash/Array of arguments to be checked against nil and empty string
assert_presence_of user: '...', repo: '...' assert_presence_of user, repo
# File lib/github_api/validations/presence.rb, line 16 def assert_presence_of(*args) hash = args.last.is_a?(::Hash) ? args.pop : {} errors = hash.select { |key, val| val.to_s.empty? } raise Github::Error::Validations.new(errors) unless errors.empty? args.each do |arg| raise ArgumentError, "parameter cannot be nil" if arg.nil? end end