Class: FilterRename::Filters::SwapNumber

Inherits:
FilterRename::FilterNumber 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



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

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

.paramsObject



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

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

Instance Method Details

#filtered_number(num, param_num) ⇒ Object



710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
# File 'lib/filter_rename/filters.rb', line 710

def filtered_number(num, param_num)
  case param_num
  when 1
    @number = num.clone
    @last_number = get_string.get_number(params_expanded[-1].to_i)
    num = @last_number
  when params_expanded.length
    num = @number
  else
    @number = [@number, num].join(ns)
    num = @last_number
  end

  num
end

#indexed_paramsObject



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

def indexed_params; 2; end