Class: Inch::Evaluation::PriorityRange

Inherits:
Object
  • Object
show all
Extended by:
Forwardable, Utils::ReadWriteMethods
Defined in:
lib/inch/evaluation/priority_range.rb

Overview

PriorityRange objects are used to associate a given range of priorities with a symbol and an arrow.

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::ReadWriteMethods

rw_method, rw_methods

Constructor Details

#initialize(symbol) ⇒ PriorityRange

Returns a new instance of PriorityRange



14
15
16
# File 'lib/inch/evaluation/priority_range.rb', line 14

def initialize(symbol)
  @symbol = symbol
end

Class Attribute Details

.priority_mapObject (readonly)

Returns the value of attribute priority_map



31
32
33
# File 'lib/inch/evaluation/priority_range.rb', line 31

def priority_map
  @priority_map
end

Class Method Details

.allObject



33
34
35
36
# File 'lib/inch/evaluation/priority_range.rb', line 33

def all
  @priority_map ||= {}
  @priority_map.values
end

.priority_range(symbol, &block) ⇒ Object



38
39
40
41
42
43
# File 'lib/inch/evaluation/priority_range.rb', line 38

def priority_range(symbol, &block)
  @priority_map ||= {}
  @priority_map[symbol] ||= PriorityRange.new(symbol)
  @priority_map[symbol].update(&block) if block
  @priority_map[symbol]
end

Instance Method Details

#to_sObject



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

def to_s
  arrow
end

#to_symObject



22
23
24
# File 'lib/inch/evaluation/priority_range.rb', line 22

def to_sym
  @symbol
end

#update(&block) ⇒ Object



18
19
20
# File 'lib/inch/evaluation/priority_range.rb', line 18

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