class FilterRename::Filters::TranslateWords

Public Class Methods

hint() click to toggle source
# File lib/filter_rename/filters.rb, line 592
def self.hint; 'Replace words in GROUP from SUBGRPS to SUBGRPD'; end
params() click to toggle source
# File lib/filter_rename/filters.rb, line 593
def self.params; 'GROUP,SUBGRPS,SUBGRPD'; end

Public Instance Methods

filter(params) click to toggle source
Calls superclass method FilterRename::FilterBase#filter
# File lib/filter_rename/filters.rb, line 595
def filter(params)
  str = get_string
  group = params[0].to_sym
  lang_src = params[1] ? params[1].to_sym : :none
  lang_dest = params[2] ? params[2].to_sym : :none

  get_words(group, lang_src).each_with_index do |x, i|
    str = str.gsub(Regexp.new(x, get_config(:ignore_case)), get_words(group, lang_dest, i))
  end

  super str
end