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, #indexed_params, #indexes, #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



279
280
281
# File 'lib/filter_rename/filters.rb', line 279

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

.paramsObject



283
284
285
# File 'lib/filter_rename/filters.rb', line 283

def self.params
  "NTH,REGEX,TARGET"
end

Instance Method Details

#filtered_occurrence(occurrence, _param_num) ⇒ Object



291
292
293
294
# File 'lib/filter_rename/filters.rb', line 291

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

#self_targeted?Boolean



287
288
289
# File 'lib/filter_rename/filters.rb', line 287

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