Permalink
Browse files

initialize instance variables

  • Loading branch information...
1 parent 1ef527f commit dc2352c58f0f05d9df171538483f31d42e9f0668 @tenderlove tenderlove committed May 2, 2012
Showing with 5 additions and 6 deletions.
  1. +5 −6 actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
@@ -124,6 +124,7 @@ def initialize(by, env)
@env = env
@delegate = {}
@loaded = false
+ @exists = nil # we haven't checked yet
end
def destroy
@@ -181,7 +182,7 @@ def inspect
end
def exists?
- return @exists if instance_variable_defined?(:@exists)
+ return @exists unless @exists.nil?
@exists = @by.send(:session_exists?, @env)
end
@@ -205,18 +206,16 @@ def load_for_write!
end
def load!
- id, session = @by.send(:load_session, @env)
+ id, session = @by.load_session @env
@env[ENV_SESSION_OPTIONS_KEY][:id] = id
@delegate.replace(stringify_keys(session))
@loaded = true
end
def stringify_keys(other)
- hash = {}
- other.each do |key, value|
+ other.each_with_object({}) { |(key, value), hash|
hash[key.to_s] = value
- end
- hash
+ }
end
end
end

0 comments on commit dc2352c

Please sign in to comment.