class ActionDispatch::Request::Session

def fetch(key, default = Unspecified, &block)

# => :bar
end
:bar
session.fetch(:foo) do

# => :bar
session.fetch(:foo, :bar)

# => KeyError: key not found: "foo"
session.fetch(:foo)

Returns default value if specified.
if can't find the given key and no default value is set.
Returns value of the given key from the session, or raises +KeyError+
def fetch(key, default = Unspecified, &block)
  load_for_read!
  if default == Unspecified
    @delegate.fetch(key.to_s, &block)
  else
    @delegate.fetch(key.to_s, default, &block)
  end
end