Class: Inch::Evaluation::Grade

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

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) ⇒ Grade

Returns a new instance of Grade.



8
9
10
# File 'lib/inch/evaluation/grade.rb', line 8

def initialize(symbol)
  @symbol = symbol
end

Class Attribute Details

.grade_mapObject (readonly)

Returns the value of attribute grade_map.



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

def grade_map
  @grade_map
end

Class Method Details

.allObject



27
28
29
30
# File 'lib/inch/evaluation/grade.rb', line 27

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

.grade(symbol, &block) ⇒ Object



32
33
34
35
36
37
# File 'lib/inch/evaluation/grade.rb', line 32

def grade(symbol, &block)
  @grade_map ||= {}
  @grade_map[symbol] ||= Grade.new(symbol)
  @grade_map[symbol].update(&block) if block
  @grade_map[symbol]
end

Instance Method Details

#to_sObject



20
21
22
# File 'lib/inch/evaluation/grade.rb', line 20

def to_s
  @symbol.to_s
end

#to_symObject



16
17
18
# File 'lib/inch/evaluation/grade.rb', line 16

def to_sym
  @symbol
end

#update(&block) ⇒ Object



12
13
14
# File 'lib/inch/evaluation/grade.rb', line 12

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