Sha256: eb87a5750b8099140027abcd6693447bde1cc9af60e5d6c5787886dca3a88b8c

Contents?: true

Size: 706 Bytes

Versions: 16

Compression:

Stored size: 706 Bytes

Contents

module SctCore
    class Config

        def self.dir
            return "#{SctCore::Helper.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 SctCore::Helper.to_hash(contents)
        end
    end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sct-0.1.35 sct_core/lib/sct_core/config.rb
sct-0.1.34 sct_core/lib/sct_core/config.rb
sct-0.1.33 sct_core/lib/sct_core/config.rb
sct-0.1.31 sct_core/lib/sct_core/config.rb
sct-0.1.30 sct_core/lib/sct_core/config.rb
sct-0.1.29 sct_core/lib/sct_core/config.rb
sct-0.1.28 sct_core/lib/sct_core/config.rb
sct-0.1.27 sct_core/lib/sct_core/config.rb
sct-0.1.26 sct_core/lib/sct_core/config.rb
sct-0.1.25 sct_core/lib/sct_core/config.rb
sct-0.1.24 sct_core/lib/sct_core/config.rb
sct-0.1.23 sct_core/lib/sct_core/config.rb
sct-0.1.22 sct_core/lib/sct_core/config.rb
sct-0.1.21 sct_core/lib/sct_core/config.rb
sct-0.1.20 sct_core/lib/sct_core/config.rb
sct-0.1.19 sct_core/lib/sct_core/config.rb