module UselessString::WithoutHelper
Public Instance Methods
remove_alphabets!(str, other_str)
click to toggle source
# File lib/helpers/without_helper.rb, line 27 def remove_alphabets!(str, other_str) remove_this_regex!(str, other_str, /[a-z]+/i) end
remove_carriage_return!(str, other_str)
click to toggle source
# File lib/helpers/without_helper.rb, line 3 def remove_carriage_return!(str, other_str) remove_this_regex!(str, other_str, /\r/) end
remove_end_of_line!(str, other_str)
click to toggle source
# File lib/helpers/without_helper.rb, line 11 def remove_end_of_line!(str, other_str) remove_this_regex!(str, other_str, /\r\n/) end
remove_line_feed!(str, other_str)
click to toggle source
# File lib/helpers/without_helper.rb, line 7 def remove_line_feed!(str, other_str) remove_this_regex!(str, other_str, /\n/) end
remove_numbers!(str, other_str)
click to toggle source
# File lib/helpers/without_helper.rb, line 19 def remove_numbers!(str, other_str) remove_this_regex!(str, other_str, /\d/) end
remove_spaces!(str, other_str)
click to toggle source
# File lib/helpers/without_helper.rb, line 15 def remove_spaces!(str, other_str) remove_this_regex!(str, other_str, / |\\t/) end
remove_special_characters!(str, other_str)
click to toggle source
# File lib/helpers/without_helper.rb, line 23 def remove_special_characters!(str, other_str) remove_this_regex!(str, other_str, /[^\da-z]+/i) end
remove_these_words!(str, other_str, target_list, case_insensitive: true)
click to toggle source
# File lib/helpers/without_helper.rb, line 40 def remove_these_words!(str, other_str, target_list, case_insensitive: true) target_list.map { |w| Regexp.escape(w.to_str) } remove_this_regex!(str, other_str, Regexp.new(Regexp.union(target_list).source, case_insensitive)) end
remove_this!(str, other_str, target)
click to toggle source
# File lib/helpers/without_helper.rb, line 31 def remove_this!(str, other_str, target) remove_this_regex!(str, other_str, /#{target.to_s}/) end
remove_this_regex!(str, other_str, regex)
click to toggle source
# File lib/helpers/without_helper.rb, line 35 def remove_this_regex!(str, other_str, regex) str.gsub!(regex, '') other_str.gsub!(regex, '') end