Module HTTPClient::Util
In: lib/httpclient/util.rb

A module for common function.

Methods

Public Instance methods

Finds a value of a Hash.

Keyword argument helper.

args:given arguments.
*field:a list of arguments to be extracted.

You can extract 3 arguments (a, b, c) with:

  include Util
  def my_method(*args)
    a, b, c = keyword_argument(args, :a, :b, :c)
    ...
  end
  my_method(1, 2, 3)
  my_method(:b => 2, :a = 1)

instead of;

  def my_method(a, b, c)
    ...
  end

Returns parent directory URI of the given URI.

Returns true if the given 2 URIs have a part_of relationship.

  • the same scheme
  • the same host String (no host resolution or IP-addr conversion)
  • the same port number
  • target URI‘s path starts with base URI‘s path.

Gets an URI instance.

[Validate]