Total Complexity | 7 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 52.94% |
Changes | 0 |
1 | # Clase para gestionar las profesiones y sus grados. |
||
3 | 1 | class Profesion < Hash |
|
4 | 1 | attr_accessor :id, :name, :aprendiz, :artesano, :maestro |
|
5 | |||
6 | 1 | def initialize(args) |
|
7 | args.each do |k, v| |
||
8 | instance_variable_set("@#{k}".to_sym, v) unless v.nil? |
||
9 | end |
||
10 | end |
||
11 | |||
12 | 1 | def img_path |
|
13 | "'../../images/profesiones/#{name}.png'" |
||
14 | end |
||
15 | |||
16 | 1 | def aprendizajes |
|
17 | profesion(id)['aprendiz'] |
||
18 | end |
||
19 | |||
20 | 1 | def artesanias |
|
21 | profesion(id)['artesano'] |
||
22 | end |
||
23 | |||
24 | 1 | def maestrias |
|
25 | profesion(id)['maestro'] |
||
26 | end |
||
27 | |||
28 | 1 | def imped |
|
29 | prof_impeds.keys[id] |
||
30 | end |
||
31 | |||
32 | 1 | def why |
|
33 | prof_impeds[imped] |
||
34 | end |
||
35 | end |
||
36 |