Methods
Instance Public methods
blank?() Link
An Pathname
is blank if it’s empty:
Pathname.new("").blank? # => true
Pathname.new(" ").blank? # => false
Pathname.new("test").blank? # => false
@return [true, false]
existence() Link
Returns the receiver if the named file exists otherwise returns nil
. pathname.existence
is equivalent to
pathname.exist? ? pathname : nil
For example, something like
content = pathname.read if pathname.exist?
becomes
content = pathname.existence&.read
@return [Pathname]