hola_milind_patel 0.1.2 → 0.1.3

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 +5 -5
  2. data/lib/hola_milind_patel.rb +75 -72
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d7d81f4e19b15d08a24843e80e782ec3de84729f
4
- data.tar.gz: 9de9f254ad4e4da4e55ec7d685cffcc6716e2a67
2
+ SHA256:
3
+ metadata.gz: 1099678892e68d95880f0f0e9816f8db928d71d652e381e3def26921d7c4f049
4
+ data.tar.gz: 43c01c538248011c6f066999e6868a48629c93387c8c3b35cbaed4db35586902
5
5
  SHA512:
6
- metadata.gz: 039eeb27813a4350321a71633f6635285e4b2e308e39827fa356d172a9648e9fdb472b2ef911d46bc75bd648300dbc9d7a45d247f51183941a666a0773b541eb
7
- data.tar.gz: 7d6fc523fd130e3eeae70238be52f92af9c16dec64ae5150f06dd068f52d0204a18b3e0b63be40523c665fb2de7d4201cc1b19da45138693249ce8ff43facacb
6
+ metadata.gz: 5c131e9a74a25a944b2ffe2a34c1d5012192aff6bd49ff6f1747369a350d2e2d33b3487352a04e17e220fc253b61cddf0cd043c1b67fbdeb92ad07c69b7256a8
7
+ data.tar.gz: 150447d78c7e1e3af7ce97cb41a9edd7a15ca1ef9d88321f56b74f40bc1950ce5b0a0a560bc5f1eff7ebd1c6527a4b22a72ff63a914421bbbaa0213bd1e2b1b4
@@ -1,81 +1,84 @@
1
1
  require 'mobility'
2
2
  module HolaMilindPatel
3
- def self.getData(model,data,language,strict)
4
- puts "============================================================"
5
- puts "Function getData Called"
6
- puts "============================================================"
7
- if language == "all"
8
- centers = data.as_json
9
- centers.map do |center|
10
- c1 = model.camelcase.constantize.find(center['id'])
11
- c1.as_json.each do |key,value|
3
+ def self.getData(data)
4
+ puts "============================================================"
5
+ puts "Function getData Called"
6
+ puts "============================================================"
7
+ if ENV['LANGUAGE'] == "all"
8
+ centers = data.as_json
9
+ centers.map do |center|
10
+ c1 = data.klass.find(center['id'])
11
+ c1.as_json.each do |key,value|
12
12
  if (c1.send("#{key}_backend") rescue "false") != "false"
13
13
  concat_attribute = key + "_backend"
14
14
  c1.send(concat_attribute.parameterize.underscore.to_sym).locales.each do |locale|
15
- center["#{key}_#{locale}"] = c1.send("#{key}_backend").read(locale)
15
+ center["#{key}_#{locale}"] = c1.send("#{key}_backend").read(locale)
16
16
  end
17
- end
18
- end
19
- center
20
- end
21
- else
22
- HolaMilindPatel.locale = language
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
17
+ end
18
+ end
19
+ center
20
+ end
21
+ else
22
+ HolaMilindPatel.locale = ENV['LANGUAGE']
23
+ #Mobility.locale = language
24
+ centers = data.as_json
25
+ if ENV['STRICT'] == "true"
26
+ centers.map do |center|
27
+ center.as_json.each do |key,value|
28
+ record = data.klass.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
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
- HolaMilindPatel.locale = language
56
- #Mobility.locale = language
57
- center = data
58
- if strict == "true"
59
- center.as_json.each do |key,value|
60
- record = model.camelcase.constantize.find(center['id'])
61
- if (record.send("#{key}_backend") rescue "false") != "false"
62
- center[key] = record.send(key.parameterize.underscore.to_sym,fallback: false)
63
- end
64
- end
65
- end
66
- return center
67
- end
39
+ def self.getShowData(data)
40
+ puts "============================================================"
41
+ puts "Function getShowData Called"
42
+ puts "============================================================"
43
+ if ENV['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
+ HolaMilindPatel.locale = ENV['LANGUAGE']
56
+ #Mobility.locale = language
57
+ center = data
58
+ if ENV['STRICT'] == "true"
59
+ center.as_json.each do |key,value|
60
+ record = data.klass.find(center['id'])
61
+ if (record.send("#{key}_backend") rescue "false") != "false"
62
+ center[key] = record.send(key.parameterize.underscore.to_sym,fallback: false)
63
+ end
64
+ end
65
+ end
66
+ return center
67
+ end
68
+ end
69
+ def self.hi
70
+ puts "===================="
71
+ puts "Hello Milind! Your Gem is working!!"
72
+ puts "===================="
73
+ end
74
+ class << self
75
+ def locale=(locale)
76
+ Mobility.locale = locale
77
+ puts "Locale has been set to " + locale
78
+ end
79
+ end
80
+
81
+ def self.configure
82
+
68
83
  end
69
- def self.hi
70
- puts "===================="
71
- puts "Hello Milind! Your Gem is working!!"
72
- puts "===================="
73
- end
74
- class << self
75
- def locale=(locale)
76
- Mobility.locale = locale
77
- puts "Locale has been set to " + locale
78
- end
79
- end
80
-
81
84
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hola_milind_patel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Milind Patel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-01 00:00:00.000000000 Z
11
+ date: 2019-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mobility
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.6.14
96
+ rubygems_version: 2.7.7
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Hola Milind!