Project

env

0.0
No commit activity in last 3 years
No release in over 3 years
Provides a Ruby interface to common environment variables, used on Windows, Linux, BSD and OSX.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.4
~> 0.7
 Project Readme

env_ext

CI

Description

env_ext adds additional methods to ENV for common environment variables, used on Linux, BSD, OSX and Windows.

Methods

  • {EnvExt::Methods#paths ENV.paths} -PATH
  • {EnvExt::Methods#ld_library_paths ENV.ld_library_paths} - LD_LIBRARY_PATH
  • {EnvExt::Methods#host_name ENV.host_name} -HOMENAME
  • {EnvExt::Methods#user ENV.user} -USER or LOGNAME
  • {EnvExt::Methods#home ENV.home} - HOME, USERPROFILE, or HOMEPATH and HOMEDRIVE on Windows.
  • {EnvExt::Methods#lang ENV.lang} - LANG
  • {EnvExt::Methods#timezone ENV.timezone} - TZ
  • {EnvExt::Methods#shell ENV.shell} - SHELL
  • {EnvExt::Methods#shell ENV.shell_name} - SHELL
  • {EnvExt::Methods#columns ENV.columns} - COLOMNS
  • {EnvExt::Methods#lines ENV.lines} - LINES
  • {EnvExt::Methods#terminal ENV.terminal} - TERM or COLORTERM
  • {EnvExt::Methods#editor ENV.editor} - EDITOR
  • {EnvExt::Methods#browser ENV.browser} - BROWSER
  • {EnvExt::Methods#debug? ENV.debug?} - DEBUG

Examples

require 'env_ext'

Parse complex variables:

ENV.home
# => #<Pathname:/home/alice>

ENV.paths
# => [#<Pathname:/usr/local/bin>, #<Pathname:/usr/bin>, #<Pathname:/bin>, #<Pathname:/usr/local/sbin>, #<Pathname:/usr/sbin>, #<Pathname:/sbin>]

ENV.lang
# => ["en_US", "utf8"]

ENV.terminal
# => "gnome-terminal"

ENV.shell
# => "/bin/bash"

ENV.editor
# => "vim"

Extend your own ENV hash:

MyENV.extend EnvExt::Methods

Install

$ gem install env_ext

Copyright

Copyright (c) 2011-2020 Hal Brodigan

See {file:LICENSE.txt} for details.