rotn 1.0.5 → 1.0.7

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: 30b15c62d65fb4fd2e75c703ceef40024e97342b
4
- data.tar.gz: 66d0a7fdc065279bb5583033aaa8d473851d2913
3
+ metadata.gz: 2c42fd20d11763916e7bc1e40c90f35f3684af97
4
+ data.tar.gz: be5ee5c169b8501aeed2442920bc940d74bf6a54
5
5
  SHA512:
6
- metadata.gz: 43c08ab9aa77cb678e761c783787f095d14968f2fcd90ad788ee3c310ca0e7d555561b267a489eab81b8fac84a54492314fae8e5e5c116bbb0371255ee3e208f
7
- data.tar.gz: c737b52ab782e3dada5410c22312982a1f03aba4926a0a750736b6dd42eb24091d01524ac232d699cf758efce934711f0f1f380015cc4591afdba5bd8c440ef1
6
+ metadata.gz: 74fae2c6227b80390389512e643a36c53469b663cb0d4ae08a2deb4b9af51de7487b6d712a50bcf10cb3482365ede27d4463dffa34aad1a4d9c160775308c6ae
7
+ data.tar.gz: a5f2f735c7c2d305b0785adaaa28bc6bb81a1ce2ee174c6b435287ccae8d3e6d88021a69f5643fc95b9c38ec30ce22714f31ddfcc170c40e8c29db654dd19a13
Binary file
data.tar.gz.sig CHANGED
Binary file
data/bin/rotn CHANGED
@@ -28,12 +28,6 @@ OptionParser.new do |o|
28
28
  end
29
29
  end.parse!
30
30
 
31
- if options.length == 0
32
- puts "rotn: missing options"
33
- puts "Try --help for more information"
34
- exit
35
- end
36
-
37
31
  if options.has_key? :help
38
32
  puts "Usage: rotn -aNUMBER [-nNUMBER] STRING|FILE"
39
33
  puts " -a, --alphabetic=NUMBER\tSet the number to shift alphabetic symbols (a-zA-Z)."
@@ -44,6 +38,12 @@ if options.has_key? :help
44
38
  exit
45
39
  end
46
40
 
41
+ if options.length == 0
42
+ puts "rotn: missing options"
43
+ puts "Try --help for more information"
44
+ exit
45
+ end
46
+
47
47
  e = false
48
48
  ARGV.each do |i|
49
49
  if Pathname.new(i).file?
@@ -10,13 +10,13 @@ class String
10
10
  #
11
11
  # Arguments:
12
12
  # map: (Hash)
13
- def shift(map)
13
+ def rotn_shift(map)
14
14
  string = self.dup
15
15
  string.tr!("a-zA-Z", Rotn.shift_dictionary(map[:a], :a)) if map.has_key? :a
16
16
  string.tr!("0-9", Rotn.shift_dictionary(map[:n], :n)) if map.has_key? :n
17
17
  return string
18
18
  end
19
- # In-place shift by N symbols
19
+ # In-place rotn_shift by N symbols
20
20
  #
21
21
  # Example:
22
22
  # >> a = "Hello World 123"
@@ -28,21 +28,21 @@ class String
28
28
  #
29
29
  # Arguments:
30
30
  # map: (Hash)
31
- def shift!(map)
32
- replace shift(map)
31
+ def rotn_shift!(map)
32
+ replace rotn_shift(map)
33
33
  end
34
- # Unshift a string by N symbols
34
+ # Unrotn_shift a string by N symbols
35
35
  #
36
36
  # Example:
37
- # >> "Yvccf Nficu 345".unshift({:a => 17, :n => 2})
37
+ # >> "Yvccf Nficu 345".unrotn_shift({:a => 17, :n => 2})
38
38
  # => "Hello World 123"
39
- def unshift(map)
39
+ def rotn_unshift(map)
40
40
  string = self.dup
41
- string.tr!("a-zA-Z", Rotn.shift_dictionary(26 - map[:a], :a)) if map.has_key? :a
42
- string.tr!("0-9", Rotn.shift_dictionary(10 - map[:n], :n)) if map.has_key? :n
41
+ string.tr!(Rotn.shift_dictionary(map[:a], :a), "a-zA-Z") if map.has_key? :a
42
+ string.tr!(Rotn.shift_dictionary(map[:n], :n), "0-9") if map.has_key? :n
43
43
  return string
44
44
  end
45
- # In-place unshift by N symbols
45
+ # In-place unrotn_shift by N symbols
46
46
  #
47
47
  # Example:
48
48
  # >> a = "Rovvy Gybvn 567"
@@ -51,7 +51,7 @@ class String
51
51
  # => "Hello World 123"
52
52
  # >> a
53
53
  # => "Hello World 123"
54
- def unshift!(map)
55
- replace unshift(map)
54
+ def rotn_unshift!(map)
55
+ replace unrotn_shift(map)
56
56
  end
57
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rotn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Black
@@ -30,7 +30,7 @@ cert_chain:
30
30
  Axuy/yOJMbFmpkrP4EiYeDjWwpZ3U80Z6J3jExBR+GDVoy/8+uPSxfh+7UD8a0QH
31
31
  LgOq3QTHStbVqOBVA/XiTIapLxpC2xOUDpVxKsktRFaBCzBe6XOC/+Hy6YI89g==
32
32
  -----END CERTIFICATE-----
33
- date: 2016-08-29 00:00:00.000000000 Z
33
+ date: 2016-09-16 00:00:00.000000000 Z
34
34
  dependencies: []
35
35
  description: A library to perform a Caesar cypher by N symbols
36
36
  email: annoying-dog@outlook.com
metadata.gz.sig CHANGED
Binary file