hola_milind_patel 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hola_milind_patel.rb +65 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 132d4afba34d046db42cb3f0dbc051cea09ca687
|
4
|
+
data.tar.gz: 3c0a93551b0c82c783e2dd6a98897c047f60cb60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d688f9e1449eb6e18015f43dfb7be7e76f13cb0c18b25f5d1eef16ae25fbf40d3829dfdb1a9ab026f3101e6ffaadfb3a9300c98479b4af1293e8580fb22bc78
|
7
|
+
data.tar.gz: 155b3d5846616a26edf402abcc4ab1c4c1d8921aee62eb3e2f4d2f9cde75502c4c9df5f6fecc68f77fb0c866e134711be0288f51bbd96ecdbb2ad6b63f5975c2
|
data/lib/hola_milind_patel.rb
CHANGED
@@ -1,9 +1,73 @@
|
|
1
1
|
require 'mobility'
|
2
2
|
module HolaMilindPatel
|
3
3
|
extend Mobility
|
4
|
+
def self.getData(model,data,language,strict)
|
5
|
+
puts "============================================================"
|
6
|
+
puts "Function getData Called"
|
7
|
+
puts "============================================================"
|
8
|
+
if language == "all"
|
9
|
+
centers = data.as_json
|
10
|
+
centers.map do |center|
|
11
|
+
c1 = model.camelcase.constantize.find(center['id'])
|
12
|
+
c1.as_json.each do |key,value|
|
13
|
+
if (c1.send("#{key}_backend") rescue "false") != "false"
|
14
|
+
concat_attribute = key + "_backend"
|
15
|
+
c1.send(concat_attribute.parameterize.underscore.to_sym).locales.each do |locale|
|
16
|
+
center["#{key}_#{locale}"] = c1.send("#{key}_backend").read(locale)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
center
|
21
|
+
end
|
22
|
+
else
|
23
|
+
Mobility.locale = language
|
24
|
+
centers = data.as_json
|
25
|
+
if strict == "true"
|
26
|
+
centers.map do |center|
|
27
|
+
center.as_json.each do |key,value|
|
28
|
+
record = model.camelcase.constantize.find(center['id'])
|
29
|
+
if (record.send("#{key}_backend") rescue "false") != "false"
|
30
|
+
center[key] = record.send(key.parameterize.underscore.to_sym,fallback: false)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
center
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
return centers
|
38
|
+
end
|
39
|
+
def self.getShowData(model,data,language,strict)
|
40
|
+
puts "============================================================"
|
41
|
+
puts "Function getShowData Called"
|
42
|
+
puts "============================================================"
|
43
|
+
if language == "all"
|
44
|
+
center = data
|
45
|
+
c = center.as_json
|
46
|
+
center.short_title_backend.locales.each do |locale|
|
47
|
+
center.as_json.each do |key,value|
|
48
|
+
if (center.send("#{key}_backend") rescue "false") != "false"
|
49
|
+
c["#{key}_#{locale}"] = center.send("#{key}_backend").read(locale)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
return c
|
54
|
+
else
|
55
|
+
Mobility.locale = language
|
56
|
+
center = data
|
57
|
+
if strict == "true"
|
58
|
+
center.as_json.each do |key,value|
|
59
|
+
record = model.camelcase.constantize.find(center['id'])
|
60
|
+
if (record.send("#{key}_backend") rescue "false") != "false"
|
61
|
+
center[key] = record.send(key.parameterize.underscore.to_sym,fallback: false)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
return center
|
66
|
+
end
|
67
|
+
end
|
4
68
|
def self.hi
|
5
69
|
puts "===================="
|
6
|
-
puts "Hello
|
70
|
+
puts "Hello Milind! Your Gem is working!!"
|
7
71
|
puts "===================="
|
8
72
|
end
|
9
73
|
end
|