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 inherited from FilterRename::FilterNumber

calculator

Methods included from IndexedParams

#filter, #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

.hint ⇒ Object



962
963
964
# File 'lib/filter_rename/filters.rb', line 962

def self.hint
  "Swap the NTH1 number with the NTH2"
end

.params ⇒ Object



966
967
968
# File 'lib/filter_rename/filters.rb', line 966

def self.params
  "NTH1,NTH2"
end

Instance Method Details

#filtered_number(num, param_num) ⇒ Object



974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
# File 'lib/filter_rename/filters.rb', line 974

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_params ⇒ Object



970
971
972
# File 'lib/filter_rename/filters.rb', line 970

def indexed_params
  2
end