Sha256: 65ee15c1c799b85e77a238d17321a009b58d06ac1ad21f1adba7cc69f73bc5e2

Contents?: true

Size: 387 Bytes

Versions: 3

Compression:

Stored size: 387 Bytes

Contents

require 'yaml'
require 'parseconfig'

class Settings

  def initialize(path)
    @path = path
    if !File.exist?(path) then FileUtils.touch(path) end
    conf = YAML.load_file(path)
    @settings = conf ? conf : Hash.new
  end

  def get(key)
    @settings[key]
  end

  def set(key, value)
    @settings[key] = value
    File.open(@path, 'w') { |f| YAML.dump(@settings, f) }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
propre-0.0.7 lib/propre/settings.rb
propre-0.0.6 lib/propre/settings.rb
propre-0.0.5 lib/propre/settings.rb