password_characters 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d634910661c0279fc63dafb14a8d1f9f130d1f47
4
- data.tar.gz: 6eead34f52538c8bd68de5e550502e7f66a6b789
3
+ metadata.gz: 86b69300ae93d38e7067b9020f6a99cf79d6f701
4
+ data.tar.gz: 0b01489b2393ef2bc32a12d670b12d41fc6bedbe
5
5
  SHA512:
6
- metadata.gz: 303450bc636953c811b9f9ba00beb88975002e1d69f1bf76b8a5e0f47f1223e111a2146b2ce67428ec8143bcc050a18242d3098ee39d7ec1b5f2b91a53e4243b
7
- data.tar.gz: 412922b4001d434972d2595966de65832644954c1506fba5867be0515ed47743c9447069efe03b8d7aff663dbcdc8ccab7feadd956ad45096561a3f0c7e4907a
6
+ metadata.gz: 751053cdc2c8d0d54ebfdd863cb8df209605cc163dc1779bf903076b5a5a6a90ce104562aa90c81be5be3809eb5deb006350c0f9d1d4191df964f52df9ce711e
7
+ data.tar.gz: 9d67c2eac483552b676bedda1b97a4a576fac0d7335e323a714b2fd5874c950650ad1cb9368c5ba535a03f00ae51fdb5b34a01dbf46d4f9b64dfe0a6de064552
@@ -0,0 +1,29 @@
1
+ class OrdinalParser
2
+ def initialize(string, password=nil)
3
+ @input = string
4
+ @password = password
5
+ end
6
+
7
+ def ordinal
8
+ case @input
9
+ when /the last/
10
+ @password.length
11
+ when /second (from|to) last/
12
+ @password.length - 1
13
+ when /third from last/
14
+ @password.length - 2
15
+ when /fourth from last/
16
+ @password.length - 3
17
+ when /first/
18
+ 1
19
+ when /second/
20
+ 2
21
+ when /third/
22
+ 3
23
+ when /fourth/
24
+ 4
25
+ else
26
+ @input[/\d+/].to_i
27
+ end
28
+ end
29
+ end
@@ -1,3 +1,3 @@
1
1
  module PasswordCharacters
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -2,4 +2,5 @@ require "password_characters/version"
2
2
 
3
3
  module PasswordCharacters
4
4
  require 'password_and_ordinals'
5
- end
5
+ require 'ordinal_parser'
6
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: password_characters
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
  - Nigel Lowry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-18 00:00:00.000000000 Z
11
+ date: 2016-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,6 +101,7 @@ files:
101
101
  - bin/console
102
102
  - bin/password_characters
103
103
  - bin/setup
104
+ - lib/ordinal_parser.rb
104
105
  - lib/password_and_ordinals.rb
105
106
  - lib/password_characters.rb
106
107
  - lib/password_characters/version.rb