Sha256: 0d7ca6663034410e5c1df7939672f79715bfd7d635a411d741115c056f402689

Contents?: true

Size: 805 Bytes

Versions: 1

Compression:

Stored size: 805 Bytes

Contents

require 'impartial/version'

module Impartial
  module Configuration
    VALID_OPTIONS_KEYS = [
      :paths
    ].freeze

    # Look for impartial templates in this location
    DEFAULT_PATHS = ['./impartials']

    attr_accessor *VALID_OPTIONS_KEYS

    # When this module is extended, set all configuration options to their default values
    def self.extended(base)
      base.reset
    end

    # Convenience method to allow configuration options to be set in a block
    def configure
      yield self
    end

    # Create a hash of options and their values
    def options
      options = {}
      VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}
      options
    end

    # Reset all configuration options to defaults
    def reset
      self.paths = DEFAULT_PATHS
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
impartial-0.0.1 lib/impartial/configuration.rb