A mixin to help validate presence of non-empty values
Instance Method Summary collapseEnsure that essential arguments are present before request is made.
Ensure that essential arguments are present before request is made.
ParametersHash/Array of arguments to be checked against nil and empty string
Example
assert_presence_of user: '...', repo: '...'
assert_presence_of user, repo
19 20 21 22 23 24 25 26 27 28
# File 'lib/github_api/validations/presence.rb', line 19 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4