Module: UselessString::CompareWithout

Includes:
WithoutHelper
Included in:
String
Defined in:
lib/compare_without.rb

Instance Method Summary collapse

Methods included from WithoutHelper

#remove_alphabets!, #remove_carriage_return!, #remove_end_of_line!, #remove_line_feed!, #remove_numbers!, #remove_spaces!, #remove_special_characters!, #remove_these_words!, #remove_this!, #remove_this_regex!

Instance Method Details

#cmp_without_alphabets(other_str) ⇒ Object



36
37
38
39
# File 'lib/compare_without.rb', line 36

def cmp_without_alphabets(other_str)
  remove_alphabets!(str = dup, other = other_str.dup)
  str <=> other
end

#cmp_without_carriage_return(other_str) ⇒ Object



6
7
8
9
# File 'lib/compare_without.rb', line 6

def cmp_without_carriage_return(other_str)
  remove_carriage_return!(str = dup, other = other_str.dup)
  str <=> other
end

#cmp_without_end_of_line(other_str) ⇒ Object



16
17
18
19
# File 'lib/compare_without.rb', line 16

def cmp_without_end_of_line(other_str)
  remove_end_of_line!(str = dup, other = other_str.dup)
  str <=> other
end

#cmp_without_line_feed(other_str) ⇒ Object



11
12
13
14
# File 'lib/compare_without.rb', line 11

def cmp_without_line_feed(other_str)
  remove_line_feed!(str = dup, other = other_str.dup)
  str <=> other
end

#cmp_without_numbers(other_str) ⇒ Object



26
27
28
29
# File 'lib/compare_without.rb', line 26

def cmp_without_numbers(other_str)
  remove_numbers!(str = dup, other = other_str.dup)
  str <=> other
end

#cmp_without_spaces(other_str) ⇒ Object



21
22
23
24
# File 'lib/compare_without.rb', line 21

def cmp_without_spaces(other_str)
  remove_spaces!(str = dup, other = other_str.dup)
  str <=> other
end

#cmp_without_special_characters(other_str) ⇒ Object



31
32
33
34
# File 'lib/compare_without.rb', line 31

def cmp_without_special_characters(other_str)
  remove_special_characters!(str = dup, other = other_str.dup)
  str <=> other
end

#cmp_without_theses_words(other_str, target_list, case_insensitive: true) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/compare_without.rb', line 52

def cmp_without_theses_words(other_str, target_list, case_insensitive: true)
  remove_these_words!(str = dup,
                      other = other_str.dup,
                      target_list.dup,
                      case_insensitive)
  str <=> other
end

#cmp_without_this(other_str, target) ⇒ Object Also known as: cmp_without_these, cmp_without_regex



41
42
43
44
45
46
47
48
# File 'lib/compare_without.rb', line 41

def cmp_without_this(other_str, target)
  if target.is_a? Regexp
    remove_this_regex!(str = dup, other = other_str.dup, target)
  else
    remove_this!(str = dup, other = other_str.dup, target)
  end
  str <=> other
end