Sha256: c7a4b988c0366d9c849481a38757ba3be98fe893a119f41152b8c41edded461d

Contents?: true

Size: 479 Bytes

Versions: 6

Compression:

Stored size: 479 Bytes

Contents

# encoding: utf-8

module TTY
  class Terminal
    # A class responsible for locating user home
    class Home
      # Find user home
      #
      # @api public
      def home
        if (env_home = ENV['HOME'])
          env_home
        else
          begin
            require 'etc'
            File.expand_path("~#{Etc.getlogin}")
          rescue
            TTY::System.windows? ?  'C:/' : '/'
          end
        end
      end
    end # Home
  end # Terminal
end # TTY

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tty-0.2.1 lib/tty/terminal/home.rb
tty-0.2.0 lib/tty/terminal/home.rb
tty-0.1.3 lib/tty/terminal/home.rb
tty-0.1.2 lib/tty/terminal/home.rb
tty-0.1.1 lib/tty/terminal/home.rb
tty-0.1.0 lib/tty/terminal/home.rb