Module | HTTPClient::Util |
In: |
lib/httpclient/util.rb
|
A module for common function.
Keyword argument to hash helper.
args: | given arguments. |
*field: | a list of arguments to be extracted. |
Returns hash which has defined keys. When a Hash given, returns it including undefined keys. When an Array given, returns a Hash which only includes defined keys.
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 true if the given 2 URIs have a part_of relationship.