Sha256: ba2e1472094c202015377c1ba258b992624eb310e2f125055cf839f127350c06

Contents?: true

Size: 367 Bytes

Versions: 5

Compression:

Stored size: 367 Bytes

Contents

require 'singleton'
require 'yaml'

class Rwiki::Configuration
  include Singleton

  CONFIG_FILE_NAME = File.join(ENV['HOME'], '.rwiki', 'config.yml')

  attr_reader :config

  def initialize
    @config = {}

    if File.exist?(CONFIG_FILE_NAME)
      @config = YAML.load_file(CONFIG_FILE_NAME) rescue {}
    end
  end

  def [](index)
    @config[index]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rwiki-0.2.4 lib/rwiki/configuration.rb
rwiki-0.2.3 lib/rwiki/configuration.rb
rwiki-0.2.2 lib/rwiki/configuration.rb
rwiki-0.2.1 lib/rwiki/configuration.rb
rwiki-0.1.3 lib/rwiki/configuration.rb