Sha256: 86cfcc65742402d5c7c4c606af56bbb3b03a5177ffddf4f5782152cd243edd6f
Contents?: true
Size: 415 Bytes
Versions: 20
Compression:
Stored size: 415 Bytes
Contents
# frozen_string_literal: true require 'active_support/core_ext/object/blank' class Object # @return +block.call(self)+ if +self+ is present, +default_value+ otherwise. def if_present(default_value = nil) return default_value unless present? block_given? ? yield(self) : self end # @return +yield+ if +self+ is blank. def if_blank return yield if blank? && block_given? self end end
Version data entries
20 entries across 20 versions & 2 rubygems