Sha256: 6392b7e33abda1f5a6e6514dfb4f058b46fd68235278378859df3ce4cd2287f8

Contents?: true

Size: 696 Bytes

Versions: 7

Compression:

Stored size: 696 Bytes

Contents

module Sct
    class Config

        def self.dir
            return "#{Sct::Helpers.homePath}/.config/sct"
        end

        def self.path
            return File.expand_path(File.join(self.dir, 'config'))
        end

        def self.exists
            return File.exists?(Config.path)
        end

        def self.get(key)
            config = self.read

            if !config.key?(key)
                return nil
            end

            return config[key]
        end

        def self.read
            if !self.exists
                return {}
            end

            contents = File.read(self.path)

            return Sct::Helpers.to_hash(contents)
        end
    end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sct-0.1.18 lib/sct/config.rb
sct-0.1.17 lib/sct/config.rb
sct-0.1.16 lib/sct/config.rb
sct-0.1.15 lib/sct/config.rb
sct-0.1.14 lib/sct/config.rb
sct-0.1.13 lib/sct/config.rb
sct-0.1.12 lib/sct/config.rb