Class: FilterRename::Filters::MoveWordTo

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



628
629
630
# File 'lib/filter_rename/filters.rb', line 628

def self.hint
  "Move the NTH word to TARGET overwriting it"
end

.params ⇒ Object



632
633
634
# File 'lib/filter_rename/filters.rb', line 632

def self.params
  "NTH,TARGET"
end

Instance Method Details

#filtered_word(word, param_num) ⇒ Object



640
641
642
643
644
645
646
647
648
649
650
# File 'lib/filter_rename/filters.rb', line 640

def filtered_word(word, param_num)
  case param_num
  when params_expanded.length
    @word = [@word, word].join(ws).strip
    set_string(@word, params[1])
  else
    @word = [@word, word].join(ws)
  end

  nil
end

#self_targeted? ⇒ Boolean

Returns:



636
637
638
# File 'lib/filter_rename/filters.rb', line 636

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