Module: CommandKit::Env::Home

Extended by:
ModuleMethods
Includes:
CommandKit::Env
Included in:
XDG
Defined in:
lib/command_kit/env/home.rb

Overview

Provides access to the HOME environment variable.

Environment Variables

  • HOME - The absolute path to the user's home directory.

Defined Under Namespace

Modules: ClassMethods, ModuleMethods

Instance Attribute Summary collapse

Attributes included from CommandKit::Env

#env

Instance Method Summary collapse

Methods included from ModuleMethods

included

Instance Attribute Details

#home_dirString (readonly)

The home directory.

Returns:

  • (String)


62
63
64
# File 'lib/command_kit/env/home.rb', line 62

def home_dir
  @home_dir
end

Instance Method Details

#initialize(**kwargs) ⇒ Object

Initializes #home_dir to either env['HOME'] or self.class.home_dir.

Parameters:

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.



73
74
75
76
77
# File 'lib/command_kit/env/home.rb', line 73

def initialize(**kwargs)
  super(**kwargs)

  @home_dir = env.fetch('HOME') { self.class.home_dir }
end