Class: Inspec::Resources::OsEnv
- Inherits:
-
Object
- Object
- Inspec::Resources::OsEnv
- Defined in:
- lib/resources/os_env.rb
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(env = nil) ⇒ OsEnv
constructor
A new instance of OsEnv.
- #split ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(env = nil) ⇒ OsEnv
Returns a new instance of OsEnv.
25 26 27 |
# File 'lib/resources/os_env.rb', line 25 def initialize(env = nil) @osenv = env end |
Instance Method Details
#content ⇒ Object
38 39 40 41 |
# File 'lib/resources/os_env.rb', line 38 def content return @content if defined?(@content) @content = value_for(@osenv) unless @osenv.nil? end |
#split ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/resources/os_env.rb', line 29 def split # we can't take advantage of `File::PATH_SEPARATOR` as code is # evaluated on the host machine path_separator = inspec.os.windows? ? ';' : ':' # -1 is required to catch cases like dir1::dir2: # where we have a trailing : content.nil? ? [] : content.split(path_separator, -1) end |
#to_s ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/resources/os_env.rb', line 43 def to_s if @osenv.nil? 'Environment variables' else "Environment variable #{@osenv}" end end |