Module: CommandKit::Env
- Defined in:
- lib/command_kit/env.rb,
lib/command_kit/env/home.rb,
lib/command_kit/env/path.rb,
lib/command_kit/env/shell.rb,
lib/command_kit/env/prefix.rb
Overview
Provides access to environment variables.
Examples
class MyCmd
include CommandKit::Env
def run
home = env['HOME']
# ...
end
end
Testing
Can be initialized with a custom env
hash for testing purposes.
MyCmd.new(env: {...})
Defined Under Namespace
Modules: Home, Path, Prefix, Shell
Instance Attribute Summary collapse
-
#env ⇒ Hash{String => String}
readonly
The environment variables hash.
Instance Method Summary collapse
-
#initialize(env: ENV, **kwargs) ⇒ Object
Initializes #env.
Instance Attribute Details
#env ⇒ Hash{String => String} (readonly)
The environment variables hash.
30 31 32 |
# File 'lib/command_kit/env.rb', line 30 def env @env end |
Instance Method Details
#initialize(env: ENV, **kwargs) ⇒ Object
Initializes #env.
43 44 45 46 47 |
# File 'lib/command_kit/env.rb', line 43 def initialize(env: ENV, **kwargs) @env = env super(**kwargs) end |