Module: Ronin::Support::Home

Defined in:
lib/ronin/support/home.rb

Overview

Represents the user's home directory.

Since:

  • 1.0.0

Constant Summary collapse

DIR =

Path to the user's home directory.

Since:

  • 1.0.0

Gem.user_home
CACHE_DIR =

Path to the user's ~/.cache/ directory.

Since:

  • 1.0.0

ENV.fetch('XDG_CACHE_HOME') do
  File.join(DIR,'.cache')
end
CONFIG_DIR =

Path to the user's ~/.config/ directory.

Since:

  • 1.0.0

ENV.fetch('XDG_CONFIG_HOME') do
  File.join(DIR,'.config')
end
LOCAL_SHARE_DIR =

Path to the user's ~/.local/share directory.

Since:

  • 1.0.0

ENV.fetch('XDG_DATA_HOME') do
  File.join(DIR,'.local','share')
end

Class Method Summary collapse

Class Method Details

.cache_dir(subdir) ⇒ String

Returns the path to the sub-directory within the ~/.cache/ directory.

Parameters:

  • subdir (String)

    The sub-directory.

Returns:

  • (String)

    The path to the ~/.cache/<subdir> directory.

Since:

  • 1.0.0



46
47
48
# File 'lib/ronin/support/home.rb', line 46

def self.cache_dir(subdir)
  File.join(CACHE_DIR,subdir)
end

.config_dir(subdir) ⇒ String

Returns the path to the sub-directory within the ~/.config/ directory.

Parameters:

  • subdir (String)

    The sub-directory.

Returns:

  • (String)

    The path to the ~/.config/<subdir> directory.

Since:

  • 1.0.0



64
65
66
# File 'lib/ronin/support/home.rb', line 64

def self.config_dir(subdir)
  File.join(CONFIG_DIR,subdir)
end

.local_share_dir(subdir) ⇒ String

Returns the path to the sub-directory within the ~/.local/share/ directory.

Parameters:

  • subdir (String)

    The sub-directory.

Returns:

  • (String)

    The path to the ~/.local/share/<subdir> directory.

Since:

  • 1.0.0



83
84
85
# File 'lib/ronin/support/home.rb', line 83

def self.local_share_dir(subdir)
  File.join(LOCAL_SHARE_DIR,subdir)
end