mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-04-27 14:57:46 +00:00
Make use of Hash#fetch.
This commit is contained in:
parent
8649485f53
commit
787a0edbb9
2 changed files with 2 additions and 2 deletions
|
|
@ -37,7 +37,7 @@ class HTTP::CookieJar::AbstractSaver
|
||||||
# Initializes each instance variable of the same name as option
|
# Initializes each instance variable of the same name as option
|
||||||
# keyword.
|
# keyword.
|
||||||
default_options.each_pair { |key, default|
|
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
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class HTTP::CookieJar::AbstractStore
|
||||||
# Initializes each instance variable of the same name as option
|
# Initializes each instance variable of the same name as option
|
||||||
# keyword.
|
# keyword.
|
||||||
default_options.each_pair { |key, default|
|
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
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue