lib/i18n/tasks/scanners/base_scanner.rb in i18n-tasks-0.7.4 vs lib/i18n/tasks/scanners/base_scanner.rb in i18n-tasks-0.7.5
- old
+ new
@@ -40,11 +40,11 @@
def keys(opts = {})
keys = traverse_files { |path|
scan_file(path, opts)
}.reduce(:+) || []
keys.group_by(&:first).map { |key, key_loc|
- [key, data: {source_occurrences: key_loc.map { |(k, attr)| attr[:data] }}]
+ [key, data: {source_occurrences: key_loc.map { |(_k, attr)| attr[:data] }}]
}
end
def read_file(path)
result = nil
@@ -59,11 +59,11 @@
# Run given block for every relevant file, according to config
# @return [Array] Results of block calls
def traverse_files
result = []
- paths = config[:paths].select { |p| File.exists?(p) }
+ paths = config[:paths].select { |p| File.exist?(p) }
if paths.empty?
log_warn "search.paths #{config[:paths].inspect} do not exist"
return result
end
Find.find(*paths) do |path|
@@ -115,10 +115,10 @@
key
end
VALID_KEY_CHARS = /[-\w.?!;:]/
VALID_KEY_RE_STRICT = /^#{VALID_KEY_CHARS}+$/
- VALID_KEY_RE = /^(#{VALID_KEY_CHARS}|[\#{}])+$/
+ VALID_KEY_RE = /^(#{VALID_KEY_CHARS}|[\#{@}])+$/
def valid_key?(key, strict = false)
return false if @key_filter && @key_filter_pattern !~ key
if strict
key =~ VALID_KEY_RE_STRICT && !key.end_with?('.')