Make use of Hash#fetch.

This commit is contained in:
Akinori MUSHA 2013-04-11 21:18:25 +09:00
parent 8649485f53
commit 787a0edbb9
2 changed files with 2 additions and 2 deletions

View file

@ -37,7 +37,7 @@ class HTTP::CookieJar::AbstractSaver
# Initializes each instance variable of the same name as option
# keyword.
default_options.each_pair { |key, default|
instance_variable_set("@#{key}", options.key?(key) ? options[key] : default)
instance_variable_set("@#{key}", options.fetch(key, default))
}
end

View file

@ -41,7 +41,7 @@ class HTTP::CookieJar::AbstractStore
# Initializes each instance variable of the same name as option
# keyword.
default_options.each_pair { |key, default|
instance_variable_set("@#{key}", options.key?(key) ? options[key] : default)
instance_variable_set("@#{key}", options.fetch(key, default))
}
end