Class: FilterRename::Filters::MoveTo

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FilterRename::FilterRegExp

#filter

Methods inherited from FilterRename::FilterBase

#current_target, #filter, #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



542
543
544
# File 'lib/filter_rename/filters.rb', line 542

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

.paramsObject



546
547
548
# File 'lib/filter_rename/filters.rb', line 546

def self.params
  "REGEX,TARGET"
end

Instance Method Details

#filtered_regexp(matches, params) ⇒ Object



550
551
552
553
554
555
556
557
# File 'lib/filter_rename/filters.rb', line 550

def filtered_regexp(matches, params)
  if matches.length > 2
    matches[1..-1].each_with_index { |x, i| set_string(x, "#{params[1]}_#{i.next}") }
  else
    set_string(matches[1], params[1])
  end
  ""
end