useless_string 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e90f3c7c7356805ff2814b61c9ad337e96d44497
4
- data.tar.gz: 3d8d0a532d2f0def4bb298969b982a9b15d2d8e8
3
+ metadata.gz: be1d8270d9f5ea13c2c59b798840b9f3aef96202
4
+ data.tar.gz: b96884005116a76932a4fcc67cfce9dc9838830b
5
5
  SHA512:
6
- metadata.gz: f1b1772254d1387b3f6648247d49bbeffb213032964c4dd3957b354bde9b82edc117979db59f1dd7657cd8426863d7dfa7c493e64853ebec137bbf8daed65fe2
7
- data.tar.gz: 7c10417f4c16ee428cc1cffb028d8f9b7f9654a17ca2e99ef02218ee4a37575f489d7d36d1a7a629ab4f9ec6e1c1df1bc783043742e0c9942915788d5836e65d
6
+ metadata.gz: e9fc659ec4e460354ec8d06a4c05750d57584d38b210dbe013b38cc73c7bd98ba44e0f6f3468020240182178ffef6f140ccdff19d3ef09c99c5700c48e8e8c32
7
+ data.tar.gz: 705a2ab3eaa628ca1b10fca1ab3f6f3eb53fdbbc8067f5d7d4d6f469d2a503e775c572c4026c026b2570486198a0322dea55df25f70ed7a1935e6ee51549f33a
data/.gitignore CHANGED
File without changes
data/CODE_OF_CONDUCT.md CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -45,6 +45,7 @@ There is also a method `eql_without?` which will take a string and an options ha
45
45
  :special_characters
46
46
  :alphabets
47
47
  :case_insensitive
48
+ :words # takes an array of words
48
49
  ```
49
50
  and `*_with_only` accept only
50
51
 
data/Rakefile CHANGED
File without changes
@@ -48,6 +48,12 @@ module UselessString
48
48
  end
49
49
 
50
50
  alias_method :cmp_without_these, :cmp_without_this
51
+
52
+ def cmp_without_theses_words(other_str, array)
53
+ remove_these_words!(str = self.dup, other = other_str.dup, array.dup)
54
+ str <=> other
55
+ end
56
+
51
57
  alias_method :cmp_without_regex, :cmp_without_this
52
58
  end
53
59
  end
data/lib/equal_without.rb CHANGED
@@ -38,5 +38,9 @@ module UselessString
38
38
  def eql_without_these?(other_str, array)
39
39
  cmp_without_these(other_str, array) == 0
40
40
  end
41
+
42
+ def eql_without_these_words?(other_str, array)
43
+ cmp_without_theses_words(other_str, array) == 0
44
+ end
41
45
  end
42
46
  end
@@ -13,7 +13,7 @@ module UselessString
13
13
  end
14
14
 
15
15
  def remove_spaces!(str, other_str)
16
- remove_this_regex!(str, other_str, / /)
16
+ remove_this_regex!(str, other_str, / |\\t/)
17
17
  end
18
18
 
19
19
  def remove_numbers!(str, other_str)
@@ -36,5 +36,10 @@ module UselessString
36
36
  str.gsub!(regex, '')
37
37
  other_str.gsub!(regex, '')
38
38
  end
39
+
40
+ def remove_these_words!(str, other_str, array)
41
+ array.map { |w| Regexp.escape(w) }
42
+ remove_this_regex!(str, other_str, Regexp.union(array))
43
+ end
39
44
  end
40
45
  end
File without changes
@@ -1,3 +1,3 @@
1
1
  module UselessString
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
File without changes
@@ -3,7 +3,6 @@ module UselessString
3
3
 
4
4
  def eql_without?(other_str, options = {})
5
5
  set_according_to_options(str = self.dup, other = other_str.dup, options)
6
- p str, other, options
7
6
  options[:case_insensitive] ? str.upcase.eql?(other.upcase) : str.eql?(other)
8
7
  end
9
8
 
@@ -22,6 +21,7 @@ module UselessString
22
21
  remove_numbers!(str, other_str) if options[:numbers]
23
22
  remove_special_characters!(str, other_str) if options[:special_characters]
24
23
  remove_alphabets!(str, other_str) if options[:alphabets]
24
+ remove_these_words!(str, other_str, options[:words]) if options[:words]
25
25
  end
26
26
  end
27
27
  end
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: useless_string
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Azam
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-10-09 00:00:00.000000000 Z
12
+ date: 2016-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler