class Concurrent::Map

def fetch(key, default_value = NULL)

Experimental RBS support (using type sampling data from the type_fusion project).

type Concurrent__Map_fetch_key = Array[Integer] | String | Class | Sprockets::DirectiveProcessor | Sprockets::Preprocessors::DefaultSourceMap | Integer | Array[] | Hash
type Concurrent__Map_fetch_return_value = ActiveModel::Type::String | nil | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Jsonb | File::Stat | String | Sprockets::Asset | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Timestamp | ActiveModel::Type::Integer | Concurrent::Map | ActiveModel::Type::Boolean | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::TimestampWithTimeZone | ActiveModel::Type::Float | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Interval | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Inet | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Date | ActiveRecord::Type::Text | ActionView::TemplateDetails::Requested | ActiveRecord::Type::DateTime | ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer | Array[String] | Array[] | Array[NilClass]

def fetch: (Concurrent__Map_fetch_key key, ?Object default_value) -> Concurrent__Map_fetch_return_value

This signature was generated using 766 samples from 6 applications.

Other tags:
    Note: - The "fetch-then-act" methods of `Map` are not atomic. `Map` is intended

Raises:
  • (KeyError) - when key is missing and no default_value is provided

Returns:
  • (Object) - the value or default value

Other tags:
    Yieldreturn: - default value

Other tags:
    Yieldparam: key -

Other tags:
    Yield: - default value for a key

Parameters:
  • default_value (Object) --
  • key (Object) --
def fetch(key, default_value = NULL)
  if NULL != (value = get_or_default(key, NULL))
    value
  elsif block_given?
    yield key
  elsif NULL != default_value
    default_value
  else
    raise_fetch_no_key
  end
end