Class: Fig::EnvironmentVariables::CaseInsensitive

Inherits:
Object
  • Object
show all
Includes:
Fig::EnvironmentVariables
Defined in:
lib/fig/environment_variables/case_insensitive.rb

Overview

Manager of a set of environment variables where the variable names are case-insensitive, e.g. on MS Windows.

Instance Method Summary collapse

Methods included from Fig::EnvironmentVariables

#empty?, #initialize, #keys, #with_environment

Instance Method Details

#[](key) ⇒ Object


13
14
15
# File 'lib/fig/environment_variables/case_insensitive.rb', line 13

def [](key)
  return @variables[key_to_store_under(key)]
end

#[]=(key, new_value) ⇒ Object


17
18
19
20
21
# File 'lib/fig/environment_variables/case_insensitive.rb', line 17

def []=(key, new_value)
  @variables[key_to_store_under(key)] = new_value

  return
end

#prepend_variable(key, new_value) ⇒ Object


23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fig/environment_variables/case_insensitive.rb', line 23

def prepend_variable(key, new_value)
  existing_key = key_to_store_under(key)

  if existing_key
    assign_value_to_existing_key(existing_key, new_value)
  else
    @variables[key] = new_value
  end

  return
end