ru_bee 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWU0ODlkMjljZDgzZTEwYTVkYjI2MmVhMzRkZTk4MGYyN2E0YTQwNg==
4
+ NjE4ZTQ0YmJhOGY2MWE4NGM5ZGU2ZDRmMzQ1ZjYwMGM1NWJiYWI3OA==
5
5
  data.tar.gz: !binary |-
6
- MGNiZWJkNzk2OTFiOTliMDEwMjBkZWVhYmYwMTFkN2Q3ZjdlMzNjNg==
6
+ ODA3NTNhYmU3ZTM4YjAyYmFjZDZhN2M1Nzg1MzU2NzM3MjlkODRlNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjRkYWQ2NWQzOGM3YmUzMWRlYzI5Y2EzYjZlZDRhMDc3YWI3ZDljNDU2Mjc5
10
- Y2NjZmE1ZTA5YWQzMTZmZDViOGViZTA2ZDFmZGQ3N2MwNWE1ZTc5NTYxODlk
11
- MDgwZmNmOWY1Y2MxNGZjMDdkMTFjNTUyNTAxMDY2ZDljYjE0MGM=
9
+ YmM0YTEzYjFmMWNjZjcxYTYyODU1NDQzMGZkNGZmYWFiODliMGU3OTA5MTBh
10
+ Njg4ZDlhNmZmM2E5NzIzZTRmNzAwYjU3N2JjNGZiYjhjNjhkYjdlN2Q1ZDFj
11
+ ZTRkYmY5MmIwZWE0ZWVkMzIwYTc1ODNkNWE5ZDE0YTZjYTFkNjI=
12
12
  data.tar.gz: !binary |-
13
- YjUyNDdmYjcwY2MxNmNiMzUwNjY0N2JhMmI4MjE5MjYzNjhkYzJiMzE4MTUx
14
- ZTI1ZDY4ZmYyMmYwZWMzMjExNmY3NGUwZWRiZDFiZDAzM2E4N2RiOTYwY2Zk
15
- NzJjZTNlZTJhZTI5MjA1MjRhZGFkZGVkMzkwM2NkZGE3ZjdjZjk=
13
+ YzgzYTMxODcxM2NjOGQwZTExYzk3ZWM2MDYxZjA0ZmNmMDZkOWM0NGRmNTJk
14
+ ZGFkNWYxYzhlYjEwMjEyMmE2YTAxZWE3NzEzYzE5OGMwNDBkYWVjYTdhYjU4
15
+ OGNiYjI0NjBlYjhkMzgyYjU3NmI0M2ZiZDQ4ZjFmNzE4YTNkY2M=
data/README.md CHANGED
@@ -43,6 +43,28 @@ Other languages coming...
43
43
  ##### `=> false`
44
44
 
45
45
 
46
+
47
+ `#misspellings`
48
+
49
+ ######Array
50
+
51
+ Array of misspellings from String
52
+
53
+ ######arguments
54
+
55
+ `#misspellings? language: 'english'`
56
+
57
+ Other languages coming...
58
+
59
+ `"This is a correct sentence. It works well and is pretty cool. You can also use numbers 123!".misspellings`
60
+
61
+ ##### `=> []`
62
+
63
+ `"This santence contains a typo.".correct?`
64
+
65
+ ##### `=> ['santence']`
66
+
67
+
46
68
  ## Contributing
47
69
 
48
70
  #### Dictionaries
@@ -1,3 +1,3 @@
1
1
  module RuBee
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/scanner.rb CHANGED
@@ -10,6 +10,14 @@ class String
10
10
  check
11
11
  end
12
12
 
13
+ def misspellings options={}
14
+ @options = options
15
+ get_parts
16
+ load_dictionary
17
+ check true
18
+ @bad_words
19
+ end
20
+
13
21
  private
14
22
 
15
23
  def get_parts
@@ -53,14 +61,16 @@ class String
53
61
  word
54
62
  end
55
63
 
56
- def check
64
+ def check collect=false
65
+ @bad_words = []
57
66
  @parts.each do |word|
58
67
  unless @dictionary.include?("#{word}") or
59
68
  @dictionary.include?("#{remove_s(word)}") or
60
69
  @dictionary.include?("#{remove_ed(word)}") or
61
70
  @dictionary.include?("#{remove_ing(word)}") or
62
71
  @dictionary.include?("#{remove_es(word)}")
63
- return false
72
+ @bad_words << word
73
+ return false unless collect
64
74
  end
65
75
  end
66
76
  true
data/spec/scanner_spec.rb CHANGED
@@ -3,7 +3,7 @@ require 'scanner'
3
3
  describe String do
4
4
 
5
5
  let(:test_string_good) { "This is a test string. It doesn't have 123 any issues." }
6
- let(:test_string_bad) { "This is a test string. But it conaens a bad word." }
6
+ let(:test_string_bad) { "This is a test string. But it conaens a bad word. bergerb" }
7
7
 
8
8
 
9
9
  describe '#correct?' do
@@ -18,6 +18,23 @@ describe String do
18
18
 
19
19
  end
20
20
 
21
+ describe '#misspellings' do
22
+
23
+ it 'should return array of misspelled words' do
24
+ expect(test_string_bad.misspellings).to eq(['conaens', 'bergerb'])
25
+ end
26
+
27
+ it 'should return array length of 2' do
28
+ expect(test_string_bad.misspellings.count).to eq(2)
29
+ end
30
+
31
+ it 'should return array empty array if all correct' do
32
+ expect(test_string_good.misspellings.count).to eq(0)
33
+ end
34
+
35
+ end
36
+
37
+
21
38
  describe '#get_parts' do
22
39
 
23
40
  it 'should break string into word parts' do
@@ -67,4 +84,5 @@ describe String do
67
84
 
68
85
  end
69
86
 
87
+
70
88
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ru_bee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - dan