Class: FilterRename::Filters::SwapWord

Inherits:
FilterRename::FilterWord 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, #normalize_index, #self_targeted?, #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



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

def self.hint; 'Swap the NTH1 word with the NTH2'; end

.paramsObject



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

def self.params; 'NTH1,NTH2'; end

Instance Method Details

#filtered_word(word, param_num) ⇒ Object



734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
# File 'lib/filter_rename/filters.rb', line 734

def filtered_word(word, param_num)
  case param_num
  when 1
    @word = word.clone
    @last_word = get_string.split(ws)[params_expanded[-1]]
    word = @last_word
  when params_expanded.length
    word = @word
  else
    @word = [@word, word].join(ws)
    word = nil
  end

  word
end

#indexed_paramsObject



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

def indexed_params; 2; end