redbreast 1.1.1 → 1.1.2

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: 55140102c283d2812b099b0ec63dc475d12faef4beac0cc12d39cca5b87c2f61
4
- data.tar.gz: 70704e2afa3b62adc8693d87cdf47891e255abdaf0b416cc11ae4190acd9d634
3
+ metadata.gz: 4333c7695d94182141a09737fe4d5c298f2c7f48ef2b0235170436cb1746f41d
4
+ data.tar.gz: b2616e3e40e1958b58cae329046e25c3619903dd90b93af89c59da8242d34205
5
5
  SHA512:
6
- metadata.gz: b7945675763fad73af01dcdd6018dbd032d782449f028f0e0d7d289cf028c4b7ce6d4ae5f129a2b47755e14a31b93cbc9bf1f6b6fe33e544558145635d5c6a78
7
- data.tar.gz: 51d20e13ab388b0e2bd71a696bda633eed452f4d2be7b6e0179ffd0d6b7f2dffe056e7f0f144c6fdf47272c0168e0b7e95afb369f269c493c8c52531b74546eb
6
+ metadata.gz: ac62100673841d410911b49bb8dfa6c2d2992ecaec3b0fac8371a8af3c6f592e907809abfbc54d6673f8e450976017ec1d47f23dae352efa69011d3cac560885
7
+ data.tar.gz: fdccea173c982b8969ee4d5cfcf4377ec615cf84b7137503a3120bcf2bd9a66541eb13a7925da21a1a215dc40b9ae631f287c238f01a9bc7331bdb9b6049e9dc
@@ -45,6 +45,17 @@ module Redbreast
45
45
  escape_with_underscore_if_needed(clean_name)
46
46
  end
47
47
 
48
+ def upper_camel_case(name)
49
+ clean_name = name
50
+ .split(/[^0-9a-zA-Z]/)
51
+ .reject(&:empty?)
52
+ .each_with_index
53
+ .map { |v, i| i.zero? ? v.tap { |char| char[0] = char[0].upcase } : v.capitalize }
54
+ .join
55
+
56
+ escape_with_underscore_if_needed(clean_name)
57
+ end
58
+
48
59
  def clean_case_name(name)
49
60
  clean_variable_name(name)
50
61
  end
@@ -40,7 +40,7 @@ module Redbreast
40
40
  text = ''
41
41
 
42
42
  names.each do |name|
43
- temp_arr = name.split('/')
43
+ temp_arr = name.split('/').map { |folder| upper_camel_case(folder) }
44
44
 
45
45
  variable_name = temp_arr.length == 1 ? clean_variable_name(name) : temp_arr.unshift(temp_arr.shift.downcase).join('')
46
46
  text += variable_declaration % variable_name + variable_implementation % [name, bundle_name[:reference]]
@@ -54,7 +54,7 @@ module Redbreast
54
54
  text = ''
55
55
 
56
56
  names.each do |name|
57
- temp_arr = name.split('/')
57
+ temp_arr = name.split('/').map { |folder| upper_camel_case(folder) }
58
58
  variable_name = temp_arr.length == 1 ? clean_variable_name(name) : temp_arr.unshift(temp_arr.shift.downcase).join('')
59
59
  text += variable % variable_name
60
60
  end
@@ -23,13 +23,13 @@ module Redbreast
23
23
  vars, arr = generate_variables(names: names, spacing: spacing, indentation: indentation, variable: variable, bundle: bundle, text: text, array: arr)
24
24
 
25
25
  arr = arr.uniq
26
- #text += indentation.empty? && text.empty? ? "\n" : ''
26
+
27
27
  arr.each do |enum_name|
28
28
  names_new = []
29
29
  names_new_enum = []
30
30
  new_enum_name = enum_name
31
31
 
32
- text += "\n" + spacing + 'enum ' + enum_name + ' {'
32
+ text += "\n" + spacing + 'enum ' + upper_camel_case(enum_name) + ' {'
33
33
  names_new, names_new_enum = separate_variables_from_folders(names: names, enum_name: enum_name, new_enum_name: new_enum_name, names_new_enum: names_new_enum, names_new: names_new)
34
34
 
35
35
  if !names_new_enum.empty? && new_enum_name == enum_name
@@ -64,7 +64,8 @@ module Redbreast
64
64
  temp_array = name.split('/')
65
65
  variable = temp_array.pop
66
66
  additional_text = temp_array.count.zero? ? '' : '.'
67
- text += "\t\t" + declaration + app_name_text + temp_array.join('.') + additional_text + clean_variable_name(variable)
67
+
68
+ text += "\t\t" + declaration + app_name_text + temp_array.map { |enum| upper_camel_case(enum) }.join('.') + additional_text + clean_variable_name(variable)
68
69
  text += name == names.last ? '' : "\n"
69
70
  end
70
71
 
@@ -23,13 +23,13 @@ module Redbreast
23
23
  vars, arr = generate_variables(names: names, spacing: spacing, indentation: indentation, variable: variable, bundle: bundle, text: text, array: arr)
24
24
 
25
25
  arr = arr.uniq
26
- #text += indentation.empty? && text.empty? ? "\n" : ''
26
+
27
27
  arr.each do |enum_name|
28
28
  names_new = []
29
29
  names_new_enum = []
30
30
  new_enum_name = enum_name
31
31
 
32
- text += "\n" + spacing + 'enum ' + enum_name + ' {'
32
+ text += "\n" + spacing + 'enum ' + upper_camel_case(enum_name) + ' {'
33
33
  names_new, names_new_enum = separate_variables_from_folders(names: names, enum_name: enum_name, new_enum_name: new_enum_name, names_new_enum: names_new_enum, names_new: names_new)
34
34
 
35
35
  if !names_new_enum.empty? && new_enum_name == enum_name
@@ -1,3 +1,3 @@
1
1
  module Redbreast
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redbreast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maroje
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-22 00:00:00.000000000 Z
11
+ date: 2021-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler