Sha256: d7c29c09ff0229669b8e35bd9d502ae5c950748bb6a9f3fc9154cad4edde7a05

Contents?: true

Size: 610 Bytes

Versions: 1

Compression:

Stored size: 610 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.2 lib/heavy_control/configurable.rb