Class: FilterRename::Filters::CopyOccurrenceTo

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

Instance Attribute Summary

Attributes included from IndexedParams

#items, #params, #params_expanded

Class Method Summary collapse

Instance Method Summary collapse

Methods included from IndexedParams

#filter, #get_indexes, #indexed_params, #normalize_index, #string_to_loop

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



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

def self.hint; 'Copy the NTH occurrence of REGEX to TARGET'; end

.paramsObject



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

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

Instance Method Details

#filtered_occurrence(occurrence, param_num) ⇒ Object



218
219
220
221
# File 'lib/filter_rename/filters.rb', line 218

def filtered_occurrence(occurrence, param_num)
  set_string(occurrence, params[-1])
  occurrence
end

#self_targeted?Boolean

Returns:



214
215
216
# File 'lib/filter_rename/filters.rb', line 214

def self_targeted?
  params[-1] == current_target
end