class Raykit::Secrets

Provides functionality to record the time execution times

Public Class Methods

new() click to toggle source
# File lib/raykit/secrets.rb, line 6
def initialize()
    if ENV.has_key?('RAYKIT_SECRETS_PATH')
        secrets_file = ENV['RAYKIT_SECRETS_PATH']
        if File.exists?(secrets_file)
            text = IO.read(secrets_file)
            if (text.length > 7 )
                data = JSON.parse(text)
                data.each{|key,value|
                    self[key] = value
                }
            end
        end
    end
end

Public Instance Methods

hide(text) click to toggle source
# File lib/raykit/secrets.rb, line 21
def hide(text)
    hidden=text
    self.each{|k,v|
        if(!v.nil? && v.length > 0)
            hidden=hidden.gsub(v,'****')
        end
    }
    hidden
end
save() click to toggle source
# File lib/raykit/secrets.rb, line 31
def save() 
    if ENV.has_key?('RAYKIT_SECRETS_PATH')
        secrets_file = ENV['RAYKIT_SECRETS_PATH']
        File.open(secrets_file,"w") { |f| f.puts self.to_json }
    end
end