rufus-mnemo 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/rufus/mnemo.rb +5 -1
  2. data/test/test.rb +17 -8
  3. metadata +3 -3
data/lib/rufus/mnemo.rb CHANGED
@@ -68,7 +68,7 @@ module Rufus
68
68
  #
69
69
  module Mnemo
70
70
 
71
- VERSION = '1.1.0'
71
+ VERSION = '1.1.1'
72
72
 
73
73
  V = %w[ a e i o u ]
74
74
  C = %w[ b d g h j k m n p r s t z ]
@@ -194,6 +194,10 @@ module Rufus
194
194
  mod = integer % SYL.length
195
195
  rest = integer / SYL.length
196
196
 
197
+ rest = rest.to_i
198
+ mod = mod.to_i
199
+ # mathn prevention
200
+
197
201
  from_i(rest) + SYL[mod]
198
202
  end
199
203
 
data/test/test.rb CHANGED
@@ -83,13 +83,22 @@ class MnemoTest < Test::Unit::TestCase
83
83
 
84
84
  def test_wi_bad_position
85
85
 
86
- %w(wi wiwi bewi nawi nabewi nawibe nawiwi).each do |bad_mnemo|
87
-
88
- error = assert_raise RuntimeError do
89
- Rufus::Mnemo::to_integer(bad_mnemo)
90
- end
91
- assert_equal "did not find syllable 'wi'", error.to_s
92
- end
93
- end
86
+ %w(wi wiwi bewi nawi nabewi nawibe nawiwi).each do |bad_mnemo|
87
+
88
+ error = assert_raise RuntimeError do
89
+ Rufus::Mnemo::to_integer(bad_mnemo)
90
+ end
91
+ assert_equal "did not find syllable 'wi'", error.to_s
92
+ end
93
+ end
94
+
95
+ def test_collision_with_mathn
96
+
97
+ assert_equal 'dobejotehozi', Rufus::Mnemo.from_i(13477774722)
98
+
99
+ require 'mathn'
100
+
101
+ assert_equal 'dobejotehozi', Rufus::Mnemo.from_i(13477774722)
102
+ end
94
103
  end
95
104
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-mnemo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-21 00:00:00 +09:00
12
+ date: 2009-12-01 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  requirements: []
51
51
 
52
52
  rubyforge_project: rufus
53
- rubygems_version: 1.3.2
53
+ rubygems_version: 1.3.5
54
54
  signing_key:
55
55
  specification_version: 3
56
56
  summary: Turning (large) integers into japanese sounding words and vice versa