Method: Elasticsearch::API::Utils#__extract_parts

Defined in:
lib/elasticsearch/api/utils.rb

#__extract_parts(arguments, valid_parts = []) ⇒ Array<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

Mutates the ‘arguments` argument, to prevent failures in `__validate_and_extract_params`.

Extracts the valid parts of the URL from the arguments

Examples:

Extract parts

__extract_parts { :foo => true }, [:foo, :bar]
# => [:foo]

Parameters:

  • arguments (Hash)

    Hash of arguments to verify and extract, **with symbolized keys**

  • valid_parts (Array<Symbol>) (defaults to: [])

    An array of symbol with valid keys

Returns:

  • (Array<String>)

    Valid parts of the URL as an array of strings


153
154
155
# File 'lib/elasticsearch/api/utils.rb', line 153

def __extract_parts(arguments, valid_parts=[])
  Hash[arguments].reduce([]) { |sum, item| k, v = item; v.is_a?(TrueClass) ? sum << k.to_s : sum << v  }
end