hola_milind_patel 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hola_milind_patel.rb +47 -37
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d02ee2ef57de494ee842e2080fc1d7d2d9f54e293d1eddd63eae18ce2708f064
4
- data.tar.gz: 1ad646f6a5a46d0e77a2e94da739e70a931126049dddebe3318f75a9e73127d7
3
+ metadata.gz: 311c9d8e1a4ece5040fdff961a46ede85d8d39e3870b8e9491f635125860c252
4
+ data.tar.gz: f710545f892070326de5754d2d77815985710ff2e3b98646e8038c38dd328185
5
5
  SHA512:
6
- metadata.gz: e3cfc6bfa3348da803e94bab3719525ed92dab6dfcae91481cae49603984cc3bf094eebe8dd712a41ca7e485d534986cfd7cb15cff23d472bd6aae9ba26629ba
7
- data.tar.gz: 7cbb7aeabbdd73674c03f516a210ca6888fb8770ac107e90ae7d13ae3d7e95564740f57bf6a9d6ef612eeb247d55d444741bef007ca85fe21921de23fc1deb03
6
+ metadata.gz: e20280b8d24aab64d374cea624b4297e57a9c416beba1a30448d34142e0ed96e872db902e2f53138a471df6bc8f437b7b09af63891cd060447f182be42f77974
7
+ data.tar.gz: 91fdb4b39a396fee5623b75a01cdaf7e5552eb7c1078adcaa2c484ce6b7682aa996367438b570f8205dd0cbf2100b2743387a79c7854c7a51240b2f9dd0228d8
@@ -2,46 +2,56 @@ require 'mobility'
2
2
  require 'config/hola_milind_patel'
3
3
  module HolaMilindPatel
4
4
 
5
- def self.translate(data)
6
- responce = getData(data) if !data[0].nil?
7
- responce = getShowData(data) if data[0].nil?
8
- return responce
9
- end
5
+ def translate_with_bubblefish(data)
6
+ # responce = getData(data) if !data[0].nil?
7
+ responce = HolaMilindPatel.getShowData(data) #if data[0].nil?
10
8
 
11
- def self.getData(data)
12
- if RequestStore.store[:selected_language] == "all"
13
- centers = data.as_json
14
- centers.map do |center|
15
- c1 = data.klass.find(center['id'])
16
- c1.as_json.each do |key,value|
17
- if (c1.send("#{key}_backend") rescue "false") != "false"
18
- concat_attribute = key + "_backend"
19
- c1.send(concat_attribute.parameterize.underscore.to_sym).locales.each do |locale|
20
- center["#{key}_#{locale}"] = c1.send("#{key}_backend").read(locale)
21
- end
22
- end
23
- end
24
- center
9
+ data.attributes.each do |key,value|
10
+ if (data.send("#{key}_backend") rescue "false") != "false"
11
+ # data.short_title = responce[key] if key == "short_title"
12
+ # data.description = responce[key] if key == "description"
13
+ data.send(key+'=', responce[key])
25
14
  end
26
- else
27
- centers = data.as_json
28
- centers.map do |center|
29
- center.as_json.each do |key,value|
30
- record = data.klass.find(center['id'])
31
- if (record.send("#{key}_backend") rescue "false") != "false"
32
- if record.send("#{key}_backend").locales.include?(RequestStore.store[:selected_language].parameterize.underscore.to_sym)
33
- center[key] = record.send("#{key}_backend").read(RequestStore.store[:selected_language].parameterize.underscore.to_sym)
34
- else
35
- center[key] = RequestStore.store[:strict] == "true" ? nil : center[key] = record.send("#{key}_backend").read(record.default_language.parameterize.underscore.to_sym)
36
- end
37
- end
38
- end
39
- center
40
- end
41
15
  end
42
- return centers
16
+ return data
43
17
  end
44
18
 
19
+
20
+
21
+ # def self.getData(data)
22
+ # if RequestStore.store[:selected_language] == "all"
23
+ # centers = data.as_json
24
+ # centers.map do |center|
25
+ # c1 = data.klass.find(center['id'])
26
+ # c1.as_json.each do |key,value|
27
+ # if (c1.send("#{key}_backend") rescue "false") != "false"
28
+ # concat_attribute = key + "_backend"
29
+ # c1.send(concat_attribute.parameterize.underscore.to_sym).locales.each do |locale|
30
+ # center["#{key}_#{locale}"] = c1.send("#{key}_backend").read(locale)
31
+ # end
32
+ # end
33
+ # end
34
+ # center
35
+ # end
36
+ # else
37
+ # centers = data.as_json
38
+ # centers.map do |center|
39
+ # center.as_json.each do |key,value|
40
+ # record = data.klass.find(center['id'])
41
+ # if (record.send("#{key}_backend") rescue "false") != "false"
42
+ # if record.send("#{key}_backend").locales.include?(RequestStore.store[:selected_language].parameterize.underscore.to_sym)
43
+ # center[key] = record.send("#{key}_backend").read(RequestStore.store[:selected_language].parameterize.underscore.to_sym)
44
+ # else
45
+ # center[key] = RequestStore.store[:strict] == "true" ? " " : record.send("#{key}_backend").read(record.default_language.parameterize.underscore.to_sym)
46
+ # end
47
+ # end
48
+ # end
49
+ # center
50
+ # end
51
+ # end
52
+ # return centers
53
+ # end
54
+
45
55
  def self.getShowData(data)
46
56
  if RequestStore.store[:selected_language] == "all"
47
57
  center = data
@@ -49,7 +59,7 @@ module HolaMilindPatel
49
59
  center.as_json.each do |key,value|
50
60
  if (center.send("#{key}_backend") rescue "false") != "false"
51
61
  concat_attribute = key + "_backend"
52
- center.send(concat_attribute.parameterize.underscore.to_sym).locales.each do |locale|
62
+ center.send(concat_attribute.parameterize.underscore.to_sym).locanilles.each do |locale|
53
63
  c["#{key}_#{locale}"] = center.send("#{key}_backend").read(locale)
54
64
  end
55
65
  end
@@ -63,7 +73,7 @@ module HolaMilindPatel
63
73
  if obj.send("#{key}_backend").locales.include?(RequestStore.store[:selected_language].parameterize.underscore.to_sym)
64
74
  center[key] = obj.send("#{key}_backend").read(RequestStore.store[:selected_language].parameterize.underscore.to_sym)
65
75
  else
66
- center[key] = RequestStore.store[:strict] == "true" ? nil : center[key] = obj.send("#{key}_backend").read(obj.default_language.parameterize.underscore.to_sym)
76
+ center[key] = RequestStore.store[:strict] == "true" ? " " : obj.send("#{key}_backend").read(obj.default_language.parameterize.underscore.to_sym)
67
77
  end
68
78
  end
69
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hola_milind_patel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Milind Patel