ix-cli 0.0.7 → 0.0.9
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 +4 -4
- data/bin/ix-cat +0 -0
- data/bin/ix-rot13 +7 -2
- data/bin/ix-rot5 +39 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72a2619cd73f53565d9ce416626d3a1427634740336b60c75d767f06cf7ae5f9
|
4
|
+
data.tar.gz: 273331403a44e58f3b16d51f40f284ef242b982e839d7c9470d8692673a477db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 900fe154770e1b644b345629ac9f9f0f786d471705b6802f44f8d282e37bca6667eb6cf1b7a9f97b87ef87931ddeceafc08ffcdd4ed88cfbf343975debb810ae
|
7
|
+
data.tar.gz: c9be4dd356b33c16fcaa0d1df11d81c0e62f070047bbe90b032d8eefca255a30ff7a822d2215ba94e20d4141ee5470818531a44df84aed7d128717f00ac87688
|
data/bin/ix-cat
CHANGED
File without changes
|
data/bin/ix-rot13
CHANGED
@@ -3,7 +3,12 @@
|
|
3
3
|
normal = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
4
4
|
rot13 = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"
|
5
5
|
|
6
|
-
STDIN.
|
7
|
-
|
6
|
+
STDIN.each_char do |char|
|
7
|
+
candidate = char.tr!(normal, rot13)
|
8
|
+
if candidate
|
9
|
+
print candidate
|
10
|
+
else
|
11
|
+
print char
|
12
|
+
end
|
8
13
|
end
|
9
14
|
|
data/bin/ix-rot5
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'isna'
|
4
|
+
|
5
|
+
UNIVERSE = (0..9).to_a
|
6
|
+
ROT = 5
|
7
|
+
DIGIT_REGEX = /^\d$/
|
8
|
+
|
9
|
+
def resolve(set, candidate)
|
10
|
+
needle = set.index(candidate)
|
11
|
+
if (needle + ROT) > set.size
|
12
|
+
return (needle - set.size + ROT)
|
13
|
+
end
|
14
|
+
if (needle + ROT) < set.size
|
15
|
+
return needle + ROT
|
16
|
+
end
|
17
|
+
if (needle == 5)
|
18
|
+
return 0
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
STDIN.each_char do |char|
|
23
|
+
next if char.chomp == ''
|
24
|
+
unless char =~ DIGIT_REGEX
|
25
|
+
print char
|
26
|
+
next
|
27
|
+
end
|
28
|
+
rotation = resolve(UNIVERSE, char.to_i)
|
29
|
+
m = (0..9).to_a.map do |n|
|
30
|
+
if n.to_s == char
|
31
|
+
char.to_ansi.green.to_s
|
32
|
+
else
|
33
|
+
n.to_s
|
34
|
+
end
|
35
|
+
end
|
36
|
+
# puts "#{rotation.to_s.to_ansi.red.to_s} = [" + (m * ', ') + "]"
|
37
|
+
print rotation
|
38
|
+
end
|
39
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ix-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuyoshi Tlacaelel
|
@@ -217,6 +217,7 @@ executables:
|
|
217
217
|
- ix-reverse
|
218
218
|
- ix-right
|
219
219
|
- ix-rm
|
220
|
+
- ix-rot5
|
220
221
|
- ix-rot13
|
221
222
|
- ix-rot3
|
222
223
|
- ix-rps
|
@@ -497,6 +498,7 @@ files:
|
|
497
498
|
- bin/ix-rm
|
498
499
|
- bin/ix-rot13
|
499
500
|
- bin/ix-rot3
|
501
|
+
- bin/ix-rot5
|
500
502
|
- bin/ix-rps
|
501
503
|
- bin/ix-ruby-constructor-arguments
|
502
504
|
- bin/ix-ruby-methods
|