Sha256: fbd76cc5d6f5a6568c8fea000ee0549e22a94f8d13a6e81b673f265472a28b4e

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

Stored size: 636 Bytes

Contents

require 'moneta'

module Ruml
  class Config
    attr_reader :path

    def initialize(path)
      @path = path.to_s

      case @path
      when /\.ya?ml/
        construct Moneta::Adapters::YAML, :file => @path
      else
        raise ArgumentError, "Couldn't find mailing list in #{@path.inspect}" unless File.directory?(@path)
        construct Moneta::Adapters::File, :dir => @path
      end
    end

    def [](name)
      @moneta[name]
    end

    def []=(name, value)
      @moneta[name] = value
    end

    def construct(adapter, *args)
      @moneta = Moneta.build do
        use adapter, *args
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruml-1.0.0 lib/ruml/config.rb