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