Sha256: cc9ce15f46a441f1588dd7bca2d257c5d56c6c53b724719f0b9b64026cba178a
Contents?: true
Size: 626 Bytes
Versions: 1
Compression:
Stored size: 626 Bytes
Contents
# frozen_string_literal: true # encoding=utf-8 # is the value empty? # class String unless defined?(blank?) def blank? empty? || /\A[[:space:]]*\z/.freeze.match?(self) end end end # is the value non-empty? # class String unless defined?(present?) def present? !empty? end end end # is the value a non-empty string or a binary? # # :reek:ManualDispatch ### temp class Object unless defined?(present?) def present? case self.class.to_s when 'FalseClass', 'TrueClass' true else self && (!respond_to?(:blank?) || !blank?) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
markdown_exec-1.3.2 | lib/object_present.rb |