Class: Greenhouse::Resources::DotenvFile::ConfigVars

Inherits:
Hash
  • Object
show all
Defined in:
lib/greenhouse/resources/dotenv_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ ConfigVars

Returns a new instance of ConfigVars.



21
22
23
# File 'lib/greenhouse/resources/dotenv_file.rb', line 21

def initialize(hash={})
  hash.each { |k,v| self[k] = v }
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
# File 'lib/greenhouse/resources/dotenv_file.rb', line 13

def [](key)
  super(format_key(key))
end

#[]=(key, value) ⇒ Object



17
18
19
# File 'lib/greenhouse/resources/dotenv_file.rb', line 17

def []=(key, value)
  super(format_key(key), value)
end

#format_key(key) ⇒ Object



9
10
11
# File 'lib/greenhouse/resources/dotenv_file.rb', line 9

def format_key(key)
  key.to_s.gsub(/[^a-z\d_]+/i, "_").upcase
end