Class: PolarBear::Command::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/polarbear/command/config.rb

Overview



Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



10
11
# File 'lib/polarbear/command/config.rb', line 10

def initialize
end

Instance Method Details

#load_from_local_settingsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/polarbear/command/config.rb', line 13

def load_from_local_settings
  config_data = Utils::Executor.instance.execute_command('set')

  hash = {}
  config_data.each_line { |l|
    updated_line = l.gsub(/\s+/, '').chomp

    regex = /(([^=;]*)=([^=;]*);?)+/
    match = updated_line.match regex
    if !match.nil? && !match[3].empty? && match[3] != '(Empty)'
      hash[match[2]] = match[3]
    end
  }
  hash
end