Sha256: fc08dc8291f647475e500e6d26492b0901a1e56beceb758b2f5850addeb4d117

Contents?: true

Size: 637 Bytes

Versions: 3

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true

require "tty-config"

module RailsApp
  class ConfigFile
    def initialize
      @config = TTY::Config.new
      @config.append_path(Dir.home)
      @config.filename = "rails_app-config"
      @config.extname = ".yml"
    end

    def exist?
      @config.exist?
    end

    def set(key, value)
      @config.set(key, value: value)
    end

    def write(force: false)
      @config.write(force: force)
    end

    def full_path
      File.join(@config.location_paths[0] + "/" + @config.filename + @config.extname)
    end

    def read
      @config.read if exist?
      @config.to_h
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_app-0.9.0 lib/rails_app/config_file.rb
rails_app-0.8.1 lib/rails_app/config_file.rb
rails_app-0.8.0 lib/rails_app/config_file.rb