From 787a0edbb91a71dec0fb5abf462f7cca61b357da Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Thu, 11 Apr 2013 21:18:25 +0900 Subject: [PATCH] Make use of Hash#fetch. --- lib/http/cookie_jar/abstract_saver.rb | 2 +- lib/http/cookie_jar/abstract_store.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/http/cookie_jar/abstract_saver.rb b/lib/http/cookie_jar/abstract_saver.rb index 766cc03..71f410a 100644 --- a/lib/http/cookie_jar/abstract_saver.rb +++ b/lib/http/cookie_jar/abstract_saver.rb @@ -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 diff --git a/lib/http/cookie_jar/abstract_store.rb b/lib/http/cookie_jar/abstract_store.rb index 0f45690..395cad9 100644 --- a/lib/http/cookie_jar/abstract_store.rb +++ b/lib/http/cookie_jar/abstract_store.rb @@ -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