method

fetch

Importance_1
v5.2.3 - Show latest stable - 0 notes - Class: Session
fetch(key, default = Unspecified, &block) public

Returns value of the given key from the session, or raises KeyError if can’t find the given key and no default value is set. Returns default value if specified.

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

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

session.fetch(:foo) do
  :bar
end
# => :bar
Show source
Register or log in to add new notes.