| Total Complexity | 7 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # Clase para gestionar las profesiones y sus grados. |
||
| 3 | class Profesion < Hash |
||
| 4 | attr_accessor :id, :name, :aprendiz, :artesano, :maestro |
||
| 5 | |||
| 6 | 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 | def img_path |
||
| 13 | "/images/profesiones/#{name}.png" |
||
| 14 | end |
||
| 15 | |||
| 16 | def aprendizajes |
||
| 17 | profesion(id)['aprendiz'] |
||
| 18 | end |
||
| 19 | |||
| 20 | def artesanias |
||
| 21 | profesion(id)['artesano'] |
||
| 22 | end |
||
| 23 | |||
| 24 | def maestrias |
||
| 25 | profesion(id)['maestro'] |
||
| 26 | end |
||
| 27 | |||
| 28 | def imped |
||
| 29 | prof_impeds.keys[id] |
||
| 30 | end |
||
| 31 | |||
| 32 | def why |
||
| 33 | prof_impeds[imped] |
||
| 34 | end |
||
| 35 | end |
||
| 36 |