Sha256: 5760259a7c033dad639e79127c0ded0db4d3d255f5a7f90d107150c8deb6ad51

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 Bytes

Contents

module Credman
  class List < Credman::Base
    def perform
      configs.each do |env, config|
        puts pastel.green("#{env}:")

        config.each do |key, value|
          deep_print_key_and_value(value, [key])
        end
      end
    end

    private

    def deep_print_key_and_value(object, key_path)
      object.each do |current_key, value|
        if value.is_a?(Hash)
          value.each { |k, val| deep_print_key_and_value({k => val}, key_path + [current_key]) }
        else
          full_key = (key_path + [current_key]).join(".")
          print_key_and_value(full_key, value)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
credman-0.0.3 lib/credman/list.rb
credman-0.0.2.pre.alpha lib/credman/list.rb