Class: Inch::Config::Evaluation

Inherits:
Object
  • Object
show all
Defined in:
lib/inch/config/evaluation.rb

Defined Under Namespace

Classes: Criteria

Instance Method Summary collapse

Constructor Details

#initialize(language) ⇒ Evaluation

Returns a new instance of Evaluation


4
5
6
7
# File 'lib/inch/config/evaluation.rb', line 4

def initialize(language)
  @language = language
  @criteria_blocks = {}
end

Instance Method Details

#criteria_for(constant_name) ⇒ Object


25
26
27
28
# File 'lib/inch/config/evaluation.rb', line 25

def criteria_for(constant_name)
  @criteria_blocks[constant_name.to_s] ||
    raise("No criteria for #{constant_name}")
end

#grade(symbol, &block) ⇒ Object


13
14
15
# File 'lib/inch/config/evaluation.rb', line 13

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

#priority(symbol, &block) ⇒ Object


17
18
19
# File 'lib/inch/config/evaluation.rb', line 17

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

#schema(constant_name, &block) ⇒ Object


21
22
23
# File 'lib/inch/config/evaluation.rb', line 21

def schema(constant_name, &block)
  @criteria_blocks[constant_name.to_s] = Criteria.new(&block)
end

#update(&block) ⇒ Object


9
10
11
# File 'lib/inch/config/evaluation.rb', line 9

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