leap_salesforce 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bc5400e3a22260ee15346243caca18a4e839d5a32237a236cedb4488e8a073d
4
- data.tar.gz: be7c25e87d9dfd868ae7e7347b64ef61bb520a9f017c031e4ec5c0e5b8b27832
3
+ metadata.gz: dad7a996366ea8a7e9dc3b7acfee0bd5a3c028b9cbbfcb900436af73a6974e80
4
+ data.tar.gz: 0a1b977c80d03b62d6e2e963e2a37ae1bd9e3185b4ac25f6eed68804a0291cd5
5
5
  SHA512:
6
- metadata.gz: 48685d0acfa0a8b0b9ae08b94bdf64d41636df9982d45636a3d9e526ff9bef3d32cea0389767a4a2b31b6f6b5b45273c16bb221fc50d0121b96ddaa799b1769d
7
- data.tar.gz: e62daf28879015af67c9eda73b495cd106450c962562c72556a4af97492511b238db493f3c21094d81fa2eba362dc05babae9f554b8b873584a1aa7002f59732
6
+ metadata.gz: 1fcb10612c2c13acd12ca01d67a2bb3a92739cb5ac88c321df5775a9c6d11e75640e74bfd5e00b0322988c0a096867c53661540fd009f6b5e85d676588b3cec5
7
+ data.tar.gz: daaad233034d817aa45bb7d5afe489cd61eb8a951d509437d8bba470ed84f37335f6f5893c15eeea2e6b6387a61f7c095123382957e57a711ce152fcecd2f7f2
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.1.7
2
+ * Bug Fix
3
+ * Enumeration handle where duplicates are created when converting to ruby style method by adding a '_1', '_2'
4
+
1
5
  Version 0.1.6
2
6
  * Bug Fix
3
7
  * Fix 'create_all' rake task
@@ -28,6 +28,21 @@ class String
28
28
  to_ruby_friendly.snakecase.gsub(/__+/, '_')
29
29
  end
30
30
 
31
+ # @return [String] Return a key name that is unique to the hash
32
+ def to_key_name_for(hash)
33
+ key_name = to_key_name
34
+ index = 0
35
+ while hash[key_name]
36
+ if ('1'..'9').cover? key_name[-1]
37
+ key_name[-1] = (key_name[-1].to_i + 1).to_s
38
+ else
39
+ key_name += '_1'
40
+ end
41
+ break if (index += 1) >= 9
42
+ end
43
+ key_name
44
+ end
45
+
31
46
  # Convert string starting with number to a human string
32
47
  def humanize_numbered_string
33
48
  self[0] = ('0'..'9').cover?(self[0]) ? self[0].to_i.humanize : self[0]
@@ -35,7 +35,9 @@ module LeapSalesforce
35
35
  picklist_name = picklist.to_key_name
36
36
  values = entity.picklist_for(picklist)
37
37
  @enum_values = {}
38
- values.each { |value| @enum_values[value.to_key_name] = value }
38
+ values.each do |value|
39
+ @enum_values[value.to_key_name_for(@enum_values)] = value
40
+ end
39
41
  content = read_template 'picklist.rb.erb', binding
40
42
  file = File.join(ENUM_FOLDER, entity.to_s.snakecase, "#{picklist_name}.rb")
41
43
  generate_file file, content
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LeapSalesforce
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leap_salesforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - IQA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-07-24 00:00:00.000000000 Z
12
+ date: 2019-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler