Sha256: 3acf8a747622fe12c7046668b68e6b52ab247013719810174a12ff0e8405bfff

Contents?: true

Size: 430 Bytes

Versions: 1

Compression:

Stored size: 430 Bytes

Contents

module ConfigRC
  #
  # Configuration stored in a file
  #
  class RcFileProvider < BaseProvider
    def initialize(prefix)
      @path = File.expand_path(File.join('~', ".#{prefix}rc"))
    end

    def map
      props = {}
      File.open(@path).select{|line| not line =~ /^[ \t]*(#.+)*$/}.each do |line|
        k, v = line.chomp.split('=', 2)
        props[k] = v
      end if File.exist?(@path)
      props
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
config-rc-0.0.1 lib/config-rc/rc_file.rb