Montura   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A img_path() 0 3 1
A initialize() 0 5 1
1
# frozen_string_literal: true
2
3
# Define la montura de un heroe. Le permite entrar sin problemas al dungeon.
4
class Montura < Hash
5
  attr_accessor :id, :name, :recorrido, :distancia, :bono, :precio
6
7
  def initialize(args)
8
    args.each do |k, v|
9
      instance_variable_set("@#{k}".to_sym, v) unless v.nil?
10
    end
11
  end
12
13
  def img_path
14
    "/images/monturas/#{name}.png"
15
  end
16
end
17
18
# DB Loader
19
def monturas
20
  load_yaml('personaje/monturas')
21
end
22
23
def montura(id)
24
  monturas[id]
25
end
26