Sha256: 3d289f76de4b50961e4129aed0f7081cb4170ff8d798a3fc194b5b364a38dca9
Contents?: true
Size: 898 Bytes
Versions: 1
Compression:
Stored size: 898 Bytes
Contents
module KeysAndOccurrences def make_occurrence(path: '', line: '', pos: 1, line_pos: 1, line_num: 1) ::I18n::Tasks::Scanners::Occurrence.new(path: path, line: line, pos: pos, line_pos: line_pos, line_num: line_num) end def make_occurrences(occurrences) occurrences.map { |attr| make_occurrence(attr) } end def make_key_occurrences(key, occurrences) ::I18n::Tasks::Scanners::KeyOccurrences.new(key: key, occurrences: make_occurrences(occurrences)) end # adjust position to account for \r on Windows def adjust_occurrences(data) if Gem.win_platform? data = data.dup data[:occurrences].map! { |occ| adjust_occurrence occ } end data end # adjust position to account for \r on Windows def adjust_occurrence(occurrence) occurrence.dup.tap { |o| o.instance_variable_set(:@pos, o.pos + o.line_num - 1) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
i18n-tasks-0.9.0.rc1 | spec/support/keys_and_occurrences.rb |