lib/http/session/options.rb in ruby-http-session-1.0.1 vs lib/http/session/options.rb in ruby-http-session-2.1.0
- old
+ new
@@ -6,18 +6,23 @@
# @!attribute [r] cache
# @return [CacheOption]
attr_reader :cache
+ # @!attribute [r] persistent
+ # @return [PersistentOption]
+ attr_reader :persistent
+
# @!attribute [r] http
# @return [HTTP::Options]
attr_reader :http
# @param [Hash] options
def initialize(options)
@cookies = HTTP::Session::Options::CookiesOption.new(options.fetch(:cookies, false))
@cache = HTTP::Session::Options::CacheOption.new(options.fetch(:cache, false))
+ @persistent = HTTP::Session::Options::PersistentOption.new(options.fetch(:persistent, false))
@http = HTTP::Options.new(
options.fetch(:http, {}).slice(
:cookies,
:encoding,
:features,
@@ -73,8 +78,18 @@
end
# @return [Options]
def with_proxy(proxy)
tap { @http = @http.with_proxy(proxy) }
+ end
+
+ # @!visibility private
+ def freeze
+ super.tap do
+ cookies.freeze
+ cache.freeze
+ persistent.freeze
+ http.freeze
+ end
end
end
end