phrase_assembler 1.3.3 → 1.3.4
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_lang_proxy.rb +8 -3
- metadata +6 -6
@@ -37,7 +37,12 @@ class PALangProxy < PATokenProxy
|
|
37
37
|
return values[@grammar[key][g_value].to_i]
|
38
38
|
else
|
39
39
|
return @grammar[key][:default].gsub(/\d+/){|index|
|
40
|
-
values[index.to_i]
|
40
|
+
if (values[index.to_i].nil? or values[index.to_i].empty?)
|
41
|
+
result = "-"
|
42
|
+
else
|
43
|
+
result = values[index.to_i]
|
44
|
+
end
|
45
|
+
result
|
41
46
|
}
|
42
47
|
end
|
43
48
|
end
|
@@ -45,7 +50,7 @@ class PALangProxy < PATokenProxy
|
|
45
50
|
def substitute_token(p_data, add_options = {}, p_options = {})
|
46
51
|
#TODO srediti da je regex takav da ne mora imati * u [^\{\}\*] dijelu
|
47
52
|
#p_data.gsub(/\{\*[^(\{\*)(\*\})\?]+\?[^(\{\*)(\*\}):]+(:[^(\{\*)(\*\}):]+)+\*\}/){|token|
|
48
|
-
p_data.gsub!(/\{\*[^\{\}\*\?]+\?[^\{\}\*:]
|
53
|
+
p_data.gsub!(/\{\*[^\{\}\*\?]+\?[^\{\}\*:]*(:[^\{\}\*:]*)+\*\}/){|token|
|
49
54
|
clear_token = token[2...-2]
|
50
55
|
key = clear_token[/[^\?]+/]
|
51
56
|
opt_params = key[/\(.+\)/]
|
@@ -64,7 +69,7 @@ class PALangProxy < PATokenProxy
|
|
64
69
|
options_key = keys[0...keys.length-1].join("_")
|
65
70
|
grammar_key = keys[keys.length - 1]
|
66
71
|
end
|
67
|
-
values = clear_token[/\?.+/][1..-1].split(':')
|
72
|
+
values = clear_token[/\?.+/][1..-1].split(':', -1)
|
68
73
|
if p_options.options_hash.has_key?(options_key.to_sym)
|
69
74
|
if opt_params.nil?
|
70
75
|
grammar_value = p_options.options_hash[options_key.to_sym].send(:"get_#{grammar_key}")
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 4
|
10
|
+
version: 1.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Lovro \xC5\xBDmak, Radan Skori\xC4\x87, Drap"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02
|
18
|
+
date: 2011-03-02 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
requirements: []
|
92
92
|
|
93
93
|
rubyforge_project: nowarning
|
94
|
-
rubygems_version: 1.
|
94
|
+
rubygems_version: 1.3.7
|
95
95
|
signing_key:
|
96
96
|
specification_version: 3
|
97
97
|
summary: Gem for building phrases
|