Completed
Push — master ( fd0c0f...d23e4a )
by Borja
05:45 queued 01:45
created

get_title()   A

Complexity

Conditions 4

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 15.2377

Importance

Changes 0
Metric Value
cc 4
dl 0
loc 12
ccs 1
cts 9
cp 0.1111
crap 15.2377
rs 9.2
c 0
b 0
f 0
1
# Template management
2 1
def get_center(template) # Responsive main method (12 units)
3
  col = 12 # Main div, for all the width
4
  col -= 3 unless template['right'].nil? # has right div
5
  col -= 3 unless template['left'].nil?  # has left div
6
  "#{col}u important(collapse)" # return total units
7
end
8
9 1
def get_title(params) # Will set website title (top left corner)
0 ignored issues
show
Coding Style introduced by
The Assignment, Branch, Condition size for get_title is considered too high. [19.72/15]. The ABC size is based on assignments, branches (method calls), and conditions.
Loading history...
10
	vista = params[:view] ||= 'Herosheet' 
11
	title ||= vista.capitalize 
12
	title = params[:param].capitalize if title == 'view' 
13
	if (vista == 'historia' || vista == 'hero') 
14
		 title = hero(params[:param].to_i).name 
15
	end 
16
	if vista == 'runa' 
17
		 title = runa(params['param'].to_i).name.upcase 
18
	end 
19
	title.gsub!('Beastslord','Señor de las Bestias') 
20
end
21
22
# DB Loader
23 1
def views
24
  load_yaml('views')
25
end
26
27
# Helpers
28 1
def view(ruta)
29
  views.find { |v| v['ruta'] == ruta }
30
end
31
32 1
def preview(ruta)
33
  erb :template, locals: view(ruta)
34
end
35
36 1
def load_partial(position)
37
  partial = position.gsub(':param', params[:param].to_s)
38
  erb :"#{partial}"
39
end
40