Class: FilterRename::Filters::Wrap
Class Method Summary
collapse
Instance Method Summary
collapse
#get_config, #get_string, #get_words, #initialize, #match?, #set_config, #set_string, #wrap_regex
Class Method Details
.hint ⇒ Object
631
|
# File 'lib/filter_rename/filters.rb', line 631
def self.hint; 'Wrap the text matching REGEX with SEPARATOR1 and SEPARATOR2'; end
|
.params ⇒ Object
632
|
# File 'lib/filter_rename/filters.rb', line 632
def self.params; 'REGEX,SEPARATOR1,SEPARATOR2'; end
|
Instance Method Details
#filter(params) ⇒ Object
634
635
636
637
638
|
# File 'lib/filter_rename/filters.rb', line 634
def filter(params)
params[0] = "(#{params[0]})" unless params[0] =~ /[()]+/
regexp = Regexp.new("(#{params[0]})", get_config(:ignore_case).to_boolean)
super get_string.gsub(regexp, "#{params[1]}\\1#{params[2]}")
end
|