Sha256: 90b4f474f182ee4dd0a93ec10ae9cd716e4f07bffec225281f036bc137733927
Contents?: true
Size: 627 Bytes
Versions: 1
Compression:
Stored size: 627 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.1 | lib/object_present.rb |