Class: FilterRename::Filters::MoveOccurrenceTo

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

.hint ⇒ Object



580
581
582
# File 'lib/filter_rename/filters.rb', line 580

def self.hint
  "Move the NTH occurrence of REGEX to TARGET overwriting it"
end

.params ⇒ Object



584
585
586
# File 'lib/filter_rename/filters.rb', line 584

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

Instance Method Details

#filtered_occurrence(occurrence, _param_num) ⇒ Object



592
593
594
595
# File 'lib/filter_rename/filters.rb', line 592

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

#self_targeted? ⇒ Boolean

Returns:



588
589
590
# File 'lib/filter_rename/filters.rb', line 588

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