phrase_assembler 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/pa_proxies/pa_csv_proxy.rb +10 -10
- data/lib/phrase_assembler.rb +1 -0
- data/lib/railtie.rb +10 -0
- data/lib/tasks/phrase_assembler.rake +1 -0
- metadata +4 -3
@@ -9,30 +9,30 @@ module PACsvProxy
|
|
9
9
|
|
10
10
|
def to_csv(file_name, options = {})
|
11
11
|
self.current_replace_token = "AAA"
|
12
|
-
substituted_values = substitute_default_tokens(data, options)
|
12
|
+
substituted_values = substitute_default_tokens(data, options, "")
|
13
13
|
File.open(file_name, 'w') {|f| f.write(substituted_values) }
|
14
14
|
return substituted_values
|
15
15
|
end
|
16
16
|
|
17
|
-
def get_csv_safe_string_line(s)
|
18
|
-
return "
|
17
|
+
def get_csv_safe_string_line(backtrace_string, s)
|
18
|
+
return "#{backtrace_string},\"#{s.gsub('"', '""')}\"\n"
|
19
19
|
end
|
20
20
|
|
21
|
-
def substitute_default_tokens(p_data, p_options)
|
21
|
+
def substitute_default_tokens(p_data, p_options, backtrace_string)
|
22
22
|
if p_data.is_a? Hash
|
23
23
|
t_text = ""
|
24
|
-
p_data.keys.sort{|a, b| a.to_s <=> b.to_s}.each{|k| t_text << substitute_default_tokens(p_data[k], p_options)}
|
24
|
+
p_data.keys.sort{|a, b| a.to_s <=> b.to_s}.each{|k| t_text << substitute_default_tokens(p_data[k], p_options, "#{backtrace_string}:#{k.to_s}")}
|
25
25
|
return t_text
|
26
26
|
elsif p_data.is_a? Array
|
27
27
|
t_text = ""
|
28
|
-
p_data.
|
28
|
+
p_data.each_index{|index| v=p_data[index];t_text << substitute_default_tokens(v, p_options, "#{backtrace_string}[#{index}]")}
|
29
29
|
return t_text
|
30
30
|
elsif p_data.is_a? String
|
31
|
-
return substitute_default_token(String.new(p_data), p_options)
|
31
|
+
return substitute_default_token(String.new(p_data), p_options, backtrace_string)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
def substitute_default_token(p_data, p_options)
|
35
|
+
def substitute_default_token(p_data, p_options, backtrace_string)
|
36
36
|
add_options = {}
|
37
37
|
result = ""
|
38
38
|
|
@@ -98,10 +98,10 @@ module PACsvProxy
|
|
98
98
|
for i in 0...max_length
|
99
99
|
temp_lang_options = {}
|
100
100
|
add_lang_options.keys.each{|k| v=add_lang_options[k]; temp_lang_options[k] = v[((i > v.length - 1) ? (v.length - 1) : i)]}
|
101
|
-
result << get_csv_safe_string_line(substitute_token(String.new(p_data), p_options, PATokenProxyOptions.new_if_needed(temp_lang_options.merge(add_options))))
|
101
|
+
result << get_csv_safe_string_line(substitute_token(backtrace_string, String.new(p_data), p_options, PATokenProxyOptions.new_if_needed(temp_lang_options.merge(add_options))))
|
102
102
|
end
|
103
103
|
else
|
104
|
-
result << get_csv_safe_string_line(substitute_token(p_data, p_options, PATokenProxyOptions.new_if_needed(add_options)))
|
104
|
+
result << get_csv_safe_string_line(backtrace_string, substitute_token(p_data, p_options, PATokenProxyOptions.new_if_needed(add_options)))
|
105
105
|
end
|
106
106
|
|
107
107
|
return result
|
data/lib/phrase_assembler.rb
CHANGED
data/lib/railtie.rb
ADDED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phrase_assembler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 8
|
10
|
+
version: 1.2.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Lovro \xC5\xBDmak, Radan Skori\xC4\x87, Drap"
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/pa_proxies/pa_token_proxy_options.rb
|
58
58
|
- lib/pa_proxies/pa_user_proxy.rb
|
59
59
|
- lib/phrase_assembler.rb
|
60
|
+
- lib/railtie.rb
|
60
61
|
- lib/tasks/phrase_assembler.rake
|
61
62
|
- lib/utils/hash_add_on.rb
|
62
63
|
- lib/utils/r_array.rb
|