A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://rubydoc.info/github/piotrmurach/github/master/Github/Validations/Format below:

Format – Documentation for piotrmurach/github (master) – RubyDoc.info

Module: Github::Validations::Format Instance Method Summary collapse Instance Method Details #assert_valid_values(permitted, params) ⇒ Object

Ensures that value for a given key is of the correct form whether matching regular expression or set of predefined values.

12
13
14
15
16
17
18
19
20
21
22
# File 'lib/github_api/validations/format.rb', line 12

def assert_valid_values(permitted, params)
  params.each do |k, v|
    next unless permitted.keys.include?(k)
    if permitted[k].is_a?(Array) && !permitted[k].include?(params[k])
      raise Github::Error::UnknownValue.new(k,v, permitted[k].join(', '))

    elsif permitted[k].is_a?(Regexp) && !(permitted[k] =~ params[k])
      raise Github::Error::UnknownValue.new(k,v, permitted[k])
    end
  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