class FilterRename::Filters::JoinWords
Public Class Methods
hint()
click to toggle source
# File lib/filter_rename/filters.rb, line 264 def self.hint; 'Join the words from NTH1 to NTH2'; end
params()
click to toggle source
# File lib/filter_rename/filters.rb, line 265 def self.params; 'NTH1,NTH2'; end
Public Instance Methods
filter(params)
click to toggle source
# File lib/filter_rename/filters.rb, line 267 def filter(params) res = get_string.split(ws) istart = word_idx(params[0], get_string) iend = word_idx(params[1], get_string) res = res.insert(istart, res[istart..iend].join) set_string res.delete_if.with_index { |x, idx| ((istart.next)..(iend.next)).include?(idx) }.join(ws) end