Method: QB::Path#try_realpath

Defined in:
lib/qb/path.rb

#try_realpathnil, Pathname

Like Pathname#realpath but returns nil instead of raising if there isn't one.

Returns:

  • (nil)

    If there is no real path.

  • (Pathname)

    If there is a real path.



235
236
237
238
239
240
241
# File 'lib/qb/path.rb', line 235

def try_realpath
  begin
    realpath
  rescue SystemCallError => error
    nil
  end
end