End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
PStore#[]
[](key)
lib/pstore.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/pstore.rb, line 417
def [](key)
in_transaction
@table[key]
end
Returns the value for the given key if the key exists. nil otherwise; if not nil, the returned value is an object or a hierarchy of objects:
Example
example_store do |store| store.transaction do store[:foo] # => 0 store[:nope] # => nil end end
Returns nil if there is no such key.
See also Hierarchical Values.
Raises an exception if called outside a transaction block.