rot19 1.2.0 → 3.3.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rot19.rb +22 -11
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66af58553d6925ba9bf9a17465a8f9caaa46cf2e
4
- data.tar.gz: e8634a915a9374f7b0a66eb0d79980410f9752b9
3
+ metadata.gz: ca26170c8b6c5cd7ff7ddf0fd4a0e46dabadc1e2
4
+ data.tar.gz: d3a8b96ef93aae5108c5d6bf35b77ba1ce829445
5
5
  SHA512:
6
- metadata.gz: 89bb0565647b86d37cc2dcc4a5631d4b1269d6a0f19c09da4546913359d711a338cb20d36491910a51bf96cb37d3845d1b9d69f4b7484d434c58a3efec984907
7
- data.tar.gz: 6cef119a844e3d15d0ef708aa3b1652708b46c7439e20214759d78fb3df334d7ff735ce00c9038130d5cfd7b80ad551298c55648ced2dffa4b219c9f9ecc2218
6
+ metadata.gz: c3f14b667bd77635b3a6fbbaad8b846ec7d4d453a8a6fd65727f6185a9b2ae8159c0fa697e61aa998ced6ae31e0ab3a5ef43dd29aeb7061f96f8143dc465470a
7
+ data.tar.gz: bff843ca8f042669ed2c92a3729281964679f126f5f0cf89d5f00920f62a23328009b6a7e8fcfa97c1a31aef011c8e4871a44cff1d842f002a9f10e05416295f
data/lib/rot19.rb CHANGED
@@ -1,12 +1,23 @@
1
- class Hola
2
- def self.hi(alphabet = ('a'..'z'))
3
- alphabet.each_byte do |c|
4
- puts c
5
- end
6
- end
1
+ class Caesar
2
+ def initialize(alphabet = ('a'..'z').to_a.join)
3
+ shift = 19
4
+ i = shift % alphabet.size #I like this
5
+ @decrypt = alphabet
6
+ @encrypt = alphabet[i..-1] + alphabet[0...i]
7
+ end
8
+
9
+ def encrypt(string)
10
+ string.tr(@decrypt, @encrypt)
11
+ end
12
+
13
+ def decrypt(string)
14
+ string.tr(@encrypt, @decrypt)
15
+ end
7
16
  end
8
- puts "Enter the String"
9
- list = gets
10
- convert_string = Hola.new.hi(list)
11
- printf "Converted Password is => "
12
- puts list
17
+
18
+ puts "Enter Original Password"
19
+ list = gets
20
+ convert_text = Caesar.new.encrypt(list)
21
+ printf "rot19 encryption password is => "
22
+ puts convert_text
23
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rot19
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandeep Chourey
@@ -10,7 +10,7 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: A simple rot19 gem
13
+ description: A simple gem for Gem for convert String to Rot19(rotation)!
14
14
  email: schourey1988@gmail.com
15
15
  executables: []
16
16
  extensions: []
@@ -40,5 +40,5 @@ rubyforge_project:
40
40
  rubygems_version: 2.4.3
41
41
  signing_key:
42
42
  specification_version: 4
43
- summary: rot19!
43
+ summary: Gem for convert String to Rot19(rotation)!
44
44
  test_files: []