Sha256: cbf2ddd6cbbf70d5e8ca2c8303a5fd562326d6f51b5b49f25a426811c3c95d39

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require_relative 'standup_md/version'
require_relative 'standup_md/file'
require_relative 'standup_md/entry'
require_relative 'standup_md/entry_list'
require_relative 'standup_md/cli'
require_relative 'standup_md/config'

##
# The main module for the gem. Provides access to configuration classes.
module StandupMD
  @config_file_loaded = false

  ##
  # Method for accessing the configuration.
  #
  # @return [StanupMD::Cli]
  def self.config
    @config ||= StandupMD::Config.new
  end

  ##
  # Reset all configuration values to their defaults.
  #
  # @return [StandupMD::Config]
  def self.reset_config
    @config = StandupMD::Config.new
  end

  ##
  # Allows for configuration via a block. Useful when making config files.
  #
  # @example
  #   StandupMD.configure { |s| s.cli.editor = 'mate' }
  def self.configure
    yield config
  end

  ##
  # Has a config file been loaded?
  #
  # @return [Boolean]
  def self.config_file_loaded?
    @config_file_loaded
  end

  ##
  # Loads a config file.
  #
  # @param [String] file
  def self.load_config_file(file)
    file = ::File.expand_path(file)
    raise "File #{file} does not exist." unless ::File.file?(file)

    @config_file_loaded = true
    load file
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
standup_md-0.3.8 lib/standup_md.rb
standup_md-0.3.7 lib/standup_md.rb
standup_md-0.3.6 lib/standup_md.rb