Class: FilterRename::Filters::JoinNumbers

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



442
443
444
# File 'lib/filter_rename/filters.rb', line 442

def self.hint
  "Join the numbers NTH1 and NTH2 and replace the NTH3 number with it"
end

.params ⇒ Object



446
447
448
# File 'lib/filter_rename/filters.rb', line 446

def self.params
  "NTH1,NTH2,NTH3"
end

Instance Method Details

#filtered_number(number, param_num) ⇒ Object



454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/filter_rename/filters.rb', line 454

def filtered_number(number, param_num)
  case param_num
  when 1
    @number = number
    number = nil
  when params_expanded.length
    number = @number
  else
    @number += number
    number = nil
  end

  number
end

#indexed_params ⇒ Object



450
451
452
# File 'lib/filter_rename/filters.rb', line 450

def indexed_params
  3
end