Class: Parametros

Inherits:
Object
  • Object
show all
Defined in:
lib/prepare.rb

Instance Method Summary collapse

Constructor Details

#initialize(nameApp = "", generateTipo = "", modulo = "", opcoes = {}, opts = {}) ⇒ Parametros

Returns a new instance of Parametros.



6
7
8
9
10
11
12
# File 'lib/prepare.rb', line 6

def initialize( nameApp = "", generateTipo = "", modulo = "", opcoes = {}, opts = {})
	@nameApp 		= nameApp
	@generateTipo 	= generateTipo
	@modulo 		= modulo
	@opcoes 		= opcoes
	@opts 			= opts
end

Instance Method Details

#controllersAppObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/prepare.rb', line 14

def controllersApp
	@files = Dir.glob('public/app/controller/*.js')
	@arqs = []
	
	for file in @files
		@arqs << file.split('public/app/controller/')[1].split('.js')[0]
	end

	return @arqs
end

#get_bindingObject



85
86
87
# File 'lib/prepare.rb', line 85

def get_binding
	binding
end

#setOpts(opts) ⇒ Object



81
82
83
# File 'lib/prepare.rb', line 81

def setOpts (opts)
	@opts 			= opts
end

#typeEdit(tipo = "") ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/prepare.rb', line 62

def typeEdit(tipo="")
	@d = self.typeList(tipo, true)
	
	if @d[0] != true
		@d = [true]
		if tipo == 'ch'
			@d << 'chave'
		elsif tipo == 've'
			@d << 'valid_email'
		elsif tipo == 'tp'
			@d << 'type_pass'
		else
			@d = [false]	
		end
	end

	return @d
end

#typeList(tipo = "", edit = false) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/prepare.rb', line 25

def typeList(tipo="", edit=false)

	@d = [true]
	@c = tipo.split('_')
	if @c.size == 2
		if @c[0] =='m'
			@d << 'mask'
			if @c[1] == 'cpf'
				@d << "Ext.util.Format.maskRenderer('999.999.999-99')"
			elsif @c[1]=='cep'
				@d << "Ext.util.Format.maskRenderer('99.999-999')"
			elsif @c[1]=='fone'
				@d << "Ext.util.Format.maskRenderer('(99) 9999-9999')"
			elsif @c[1]=='cnpj'
				@d << "Ext.util.Format.maskRenderer('99.999.999/9999-99')"
			elsif @c[1]=='money'
				@d << "Ext.util.Format.maskRenderer('R$ #9.999.990,00', true)"
			else
				@d = [false]
			end	
		elsif @c[0] =='r'
			if edit == true
				@d << true
				@d << @c[1]
			else
				@d = [false]	
			end	
		else
			@d = [false]
		end
	else
		@d = [false]	
	end

	return @d
end