Method: Weak::Map#default
- Defined in:
- lib/weak/map.rb
permalink #default(key = UNDEFINED) ⇒ Object
Returns the default value for the given ‘key`. The returned value will be determined either by the default proc or by the default value. With no argument, returns the current default value (initially `nil`). If `key` is given, returns the default value for `key`, regardless of whether that key exists.
375 376 377 378 379 380 381 |
# File 'lib/weak/map.rb', line 375 def default(key = UNDEFINED) if UNDEFINED.equal? key @default_value else _default(key) end end |