Class: FilterRename::Filters::MoveTo

Inherits:
FilterRename::FilterBase show all
Defined in:
lib/filter_rename/filters.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FilterRename::FilterBase

#get_config, #get_string, #get_words, #initialize, #match?, #set_config, #set_string, #wrap_regex

Constructor Details

This class inherits a constructor from FilterRename::FilterBase

Class Method Details

.hintObject



299
# File 'lib/filter_rename/filters.rb', line 299

def self.hint; 'Move the text selected by REGEX to TARGET'; end

.paramsObject



300
# File 'lib/filter_rename/filters.rb', line 300

def self.params; 'REGEX,TARGET'; end

Instance Method Details

#filter(params) ⇒ Object



302
303
304
305
306
307
# File 'lib/filter_rename/filters.rb', line 302

def filter(params)
  regex = Regexp.new(wrap_regex(params[0]), get_config(:ignore_case).to_boolean)
  set_string(get_string.scan(regex).pop.to_a.pop, params[1])
  str = get_string.gsub(regex, '')
  super str
end