Sha256: 9ccbba830c1414a4326ff39d3a0a7eec16f2b89b4b6529d23aa854eb5b077218

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

module Inch
  # Stores the configuration for Inch
  #
  # @see config/defaults.rb
  class Config
    class << self
      attr_accessor :instance

      def run(&block)
        self.instance ||= new
        instance.update(&block)
        instance
      end
    end

    def update(&block)
      instance_eval(&block)
    end

    def development?
      @development
    end

    def development!
      @development = true
    end

    def evaluation(&block)
      @evaluation ||= Evaluation.new
      @evaluation.update(&block) if block
      @evaluation
    end

    class Evaluation
      def update(&block)
        instance_eval(&block)
      end

      def grade(symbol, &block)
        ::Inch::Evaluation::Grade.grade(symbol, &block)
      end

      def priority(symbol, &block)
        ::Inch::Evaluation::PriorityRange.priority_range(symbol, &block)
      end

      def schema(constant_name, &block)
        constant = ::Inch::Evaluation::Proxy.const_get(constant_name)
        constant.criteria(&block)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
inch-0.3.1 lib/inch/config.rb
inch-0.3.1.rc6 lib/inch/config.rb
inch-0.3.1.rc5 lib/inch/config.rb
inch-0.3.1.rc4 lib/inch/config.rb
inch-0.3.1.rc3 lib/inch/config.rb
inch-0.3.1.rc2 lib/inch/config.rb
inch-0.3.1.rc1 lib/inch/config.rb
inch-0.3.0 lib/inch/config.rb
inch-0.3.0.rc3 lib/inch/config.rb