Sha256: 530729a3afcc0f0f502138fbb6bbcf0ff241a53fa6a590d6f120b16733234bed
Contents?: true
Size: 371 Bytes
Versions: 253
Compression:
Stored size: 371 Bytes
Contents
# frozen_string_literal: true class Object # @return +block.call(self)+ if +self+ is not nil, +default_value+ otherwise. def if_not_nil(default_value = nil) return default_value if nil? block_given? ? yield(self) : self end # @return +yield+ if +self+ is nil, +self+ otherwise. def if_nil return yield if nil? && block_given? self end end
Version data entries
253 entries across 253 versions & 4 rubygems