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/ParameterFilter below:

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

Module: Github::ParameterFilter
Included in:
API::Arguments
Defined in:
lib/github_api/parameter_filter.rb
Overview

Allows you to specify parameters keys which will be preserved in parameters hash and its subhashes. Any keys from the nested hash that do not match will be removed.

Instance Method Summary collapse Instance Method Details #filter!(keys, params, options = {:recursive => true}) ⇒ Object

Removes any keys from nested hashes that don’t match predefiend keys

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/github_api/parameter_filter.rb', line 14

def filter!(keys, params, options={:recursive => true})    case params
  when Hash, ParamsHash
    params.keys.each do |k, v|
      unless (keys.include?(k) or Github::Validations::VALID_API_KEYS.include?(k))
        params.delete(k)
      else
        filter!(keys, params[k]) if options[:recursive]
      end
    end
  when Array
    params.map! do |el|
      filter!(keys, el) if options[:recursive]
    end
  else
    params
  end
  return params
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