Profesion   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A maestrias() 0 3 1
A imped() 0 3 1
A why() 0 3 1
A initialize() 0 5 1
A aprendizajes() 0 3 1
A img_path() 0 3 1
A artesanias() 0 3 1
1
# frozen_string_literal: true
2
3
# Clase para gestionar las profesiones y sus grados.
4
# TODO necesita refactor segun la nueva forma de organizar los datos
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