module Ptf::Config

Constants

EDITABLE
STATIC
YAML_LOCATION

Public Class Methods

get_config() click to toggle source
# File lib/ptf/config.rb, line 24
def self.get_config
  yaml_settings = {}

  yaml_settings = YAML.load(File.read(YAML_LOCATION)) if File.exist?(YAML_LOCATION)

  EDITABLE.merge(yaml_settings).merge(STATIC)
end
write_config(config) click to toggle source
# File lib/ptf/config.rb, line 32
def self.write_config(config)
  new_config = EDITABLE.merge config.select { |k| EDITABLE.keys.include? k }

  yaml_file = File.new(YAML_LOCATION, "w")
  yaml_file.puts new_config.to_yaml
  yaml_file.close
end