Is there a better way than below? (Note: I don't want to implement 
realpath et al myself :-).

  require 'pathname'

  def realpath(p)
    Pathname.new(p).realpath
  end

  def basename(p)
    Pathname.new(p).basename
  end

  def dirname(p)
    Pathname.new(p).dirname
  end

Regards,
dave