lib/apstrings/strings_validator.rb in apstrings-0.2.2 vs lib/apstrings/strings_validator.rb in apstrings-0.2.4
- old
+ new
@@ -76,20 +76,22 @@
sf.keys.detect {
|e| sf.keys.count(e) > 1
}
end
+
def self.validate_special_characters(file)
puts "apstrings: checking syntax for #{file}..."
sf = Validator::paredFile(file)
variables_regex = /%[hlqLztj]?[@%dDuUxXoOfeEgGcCsSpaAF]/
mismatchs = []
sf.key_values.each {
|e| e.each_pair {
|key,value|
fixed_key = Validator::value_in_master(key)
- striped_value = value.gsub(/%\d\$/,'%') # Strip numbered format placeholders , e.g. %1$@ --> %@
- key_variables = fixed_key.scan(variables_regex)
+ striped_key = fixed_key.gsub(/%\d\$/,'%') # Strip numbered format placeholders , e.g. %1$@ --> %@
+ striped_value = value.gsub(/%\d\$/,'%')
+ key_variables = striped_key.scan(variables_regex)
value_variables = striped_value.scan(variables_regex)
if !(key_variables.sort == value_variables.sort)
mismatchs << {key => value}
end
}