Module: CommandKit::Env::Prefix

Includes:
CommandKit::Env
Included in:
Completion::Install
Defined in:
lib/command_kit/env/prefix.rb

Overview

Methods related to the PREFIX environment variable.

Environment Variables

  • PREFIX - The optional root prefix of the file-system.

Since:

  • 0.5.0

Instance Attribute Summary collapse

Attributes included from CommandKit::Env

#env

Instance Method Summary collapse

Instance Attribute Details

#rootString (readonly)

The root of the file-system.

Returns:

  • (String)

    The PREFIX environment variable, or / if no PREFIX environment variable is given.

Since:

  • 0.5.0



24
25
26
# File 'lib/command_kit/env/prefix.rb', line 24

def root
  @root
end

Instance Method Details

#initialize(**kwargs) ⇒ Object

Initialize #root based on the PREFIX environment

Parameters:

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Since:

  • 0.5.0



34
35
36
37
38
# File 'lib/command_kit/env/prefix.rb', line 34

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

  @root = env.fetch('PREFIX','/')
end