Sha256: 86ea2787965d2885bdbedce26bbb4e09a4774252cb0c905a5a33c3d606aa8ce9
Contents?: true
Size: 629 Bytes
Versions: 2
Compression:
Stored size: 629 Bytes
Contents
class Kumogata::ConfigParser attr_reader :path def initialize(path = '~/.aws/config') self.path = path @profiles = {} end def path=(v) @path = Pathname.new(v).expand_path end def [](profile_name) @profiles[profile_name.to_s] end def parse! profile_name = nil @path.each_line do |line| line.strip! next if line.empty? if line =~ /\A\[(.+)\]\z/ profile_name = $1 elsif profile_name key, value = line.split('=', 2).map {|i| i.strip } @profiles[profile_name] ||= {} @profiles[profile_name][key] = value end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kumogata-0.4.19 | lib/kumogata/config_parser.rb |
kumogata-0.4.18 | lib/kumogata/config_parser.rb |