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.
@@ -1,3 +1,3 @@
1
1
  module TakeshiToolv1
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.1"
3
3
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: takeshiToolv1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: