class Object
Public Instance Methods
color_params(ini)
click to toggle source
# File lib/awsprofiles.rb, line 19 def color_params(ini) colors = random_colors src = { } ini.each do |s,k,v| case k when 'source_profile' then src[v] = v.colorize(colors[src.length]) when 'role_arn' then acct = get_account(v) src[acct] = acct.colorize(colors[src.length % colors.length]) end end return src end
color_profiles(ini)
click to toggle source
# File lib/awsprofiles.rb, line 34 def color_profiles(ini) colors = random_colors tar = { } ini.each_section do |s| prof = s.gsub(/^profile /, '') tar[prof] = prof.colorize(colors[tar.length % colors.length]) end return tar end
get_account(arn)
click to toggle source
# File lib/awsprofiles.rb, line 15 def get_account(arn) return arn.scan(/arn:aws:.*:(.*):.*/).last.first end
random_colors()
click to toggle source
# File lib/awsprofiles.rb, line 10 def random_colors skip_colors = [:black, :light_black, :blue, :light_blue, :default] return String.colors.shuffle.select { |c| not skip_colors.include? c} end