Sha256: d9afab7f9f7381758235a4af38135a6433c3738d23624356e4107f83c80e159c

Contents?: true

Size: 526 Bytes

Versions: 2

Compression:

Stored size: 526 Bytes

Contents

require 'yaml'

module Concrete

class Config

  def initialize(filename)
    @filename = filename
  end

  def loadValue(key)
    config = loadConfig
    config[key] if config.is_a?(Hash)
  end

  def storeValue(key, value)
    config = loadConfig
    config[key] = value
    File.open(@filename, "w") do |f|
      YAML.dump(config, f)
    end
  end
  
  private
  
  def loadConfig
    if File.exist?(@filename)
      YAML.load_file(@filename) 
    else
      {}
    end
  end

end

end 

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
concrete-0.2.1 lib/concrete/config.rb
concrete-0.2.0 lib/concrete/config.rb