Sha256: 26f3b61321af1ce2d044aa0301d8971dc78580c46eef412f97357a4ba8155239

Contents?: true

Size: 391 Bytes

Versions: 7

Compression:

Stored size: 391 Bytes

Contents

module Dude
  module Settings
    CONFIG_FILE = '.duderc'

    def settings
      @settings ||= read(file).strip.split("\n").map do |line|
        next if line =~ /^#/ || line.empty?
        line.split('=').map(&:strip)
      end.compact.to_h
    end

    private

    def file
      @file = File.join(Dir.home, CONFIG_FILE)
    end

    def read(file)
      IO.read(file)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dude-cli-2.0.6 lib/dude/settings.rb
dude-cli-2.0.5 lib/dude/settings.rb
dude-cli-2.0.4 lib/dude/settings.rb
dude-cli-2.0.3 lib/dude/settings.rb
dude-cli-2.0.2 lib/dude/settings.rb
dude-cli-2.0.1 lib/dude/settings.rb
dude-cli-2.0.0 lib/dude/settings.rb