class Kondate::PropertyFile

Attributes

path[R]
source_files[R]

Public Class Methods

new(path, source_files) click to toggle source
# File lib/kondate/property_file.rb, line 7
def initialize(path, source_files)
  @path = path
  @source_files = source_files
end

Public Instance Methods

empty?() click to toggle source
# File lib/kondate/property_file.rb, line 20
def empty?
  @path.nil?
end
load() click to toggle source
# File lib/kondate/property_file.rb, line 16
def load
  YAML.load_file(path)
end
read() click to toggle source
# File lib/kondate/property_file.rb, line 12
def read
  mask_secrets(File.read(path))
end

Private Instance Methods

mask_secrets(str) click to toggle source
# File lib/kondate/property_file.rb, line 26
def mask_secrets(str)
  str.gsub(/(.*key[^:]*): (.*)$/, '\1: *******').
    gsub(/(.*password[^:]*): (.*)$/, '\1: *******').
    gsub(/(-----BEGIN\s+PRIVATE\s+KEY-----)[0-9A-Za-z+\/=\s\\]+(-----END\s+PRIVATE\s+KEY-----)/m, '\1 xxxxx \2')
end