takeshiToolv1 0.0.2 → 0.1.1
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.
- data/lib/takeshiToolv1/version.rb +1 -1
- data/lib/takeshiToolv1.rb +27 -0
- metadata +1 -1
data/lib/takeshiToolv1.rb
CHANGED
@@ -5,3 +5,30 @@ module TakeshiToolv1
|
|
5
5
|
puts "this is the code!"
|
6
6
|
end
|
7
7
|
end
|
8
|
+
|
9
|
+
class String
|
10
|
+
def isTwID?
|
11
|
+
a_to_n = (10..17).to_a
|
12
|
+
a_to_n.push 34
|
13
|
+
a_to_n += (18..22).to_a
|
14
|
+
a_to_n.push 35
|
15
|
+
a_to_n += (23..29).to_a
|
16
|
+
a_to_n.push 32
|
17
|
+
a_to_n += (30..31).to_a
|
18
|
+
a_to_n.push 33
|
19
|
+
|
20
|
+
place_n = a_to_n[self[0].ord-'A'.ord]
|
21
|
+
|
22
|
+
sum = 0
|
23
|
+
sum += place_n/10 + (place_n%10)*9
|
24
|
+
tmp = 8
|
25
|
+
|
26
|
+
1.upto(8) do |i|
|
27
|
+
sum += (self[i].ord - '0'.ord)*tmp
|
28
|
+
tmp -= 1
|
29
|
+
end
|
30
|
+
|
31
|
+
sum += (self[9].ord - '0'.ord)
|
32
|
+
sum%10 == 0
|
33
|
+
end
|
34
|
+
end
|