Sha256: 7147e8aa6e1784b00777f156db2c7d34cc0fce85e5504b5a53b878242d7a7468

Contents?: true

Size: 611 Bytes

Versions: 1

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

module HeavyControl
  module Configurable
    def config(&block)
      reset! unless @config

      return @config if block.nil?

      instance_eval(&block)
    end

    private

    # DSL methods

    def reset!
      @config = {
        debug: false,
        ignore_subfolders: [],
        always_load: []
      }
    end

    def debug(value = true)
      @config[:debug] = value
    end

    def ignore_subfolder(subfolder)
      @config[:ignore_subfolders] << subfolder
    end

    def always_load(*const_names)
      @config[:always_load] += const_names
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heavy_control-0.1.3 lib/heavy_control/configurable.rb