rufus-mnemo 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +6 -1
- data/LICENSE.txt +1 -1
- data/README.md +84 -0
- data/lib/rufus/mnemo.rb +8 -9
- data/rufus-mnemo.gemspec +1 -1
- data/test/test.rb +13 -23
- metadata +36 -55
- data/README.rdoc +0 -82
data/CHANGELOG.txt
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
Copyright (c) 2007-
|
2
|
+
Copyright (c) 2007-2012, John Mettraux, jmettraux@gmail.com
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
|
2
|
+
# rufus-mnemo #
|
3
|
+
|
4
|
+
This gem provides methods for turning integer into easier to remember 'words' and vice-versa.
|
5
|
+
|
6
|
+
The module Rufus::Mnemo has all the explanation.
|
7
|
+
|
8
|
+
|
9
|
+
## getting it ##
|
10
|
+
|
11
|
+
gem install rufus-mnemo
|
12
|
+
|
13
|
+
|
14
|
+
## usage ##
|
15
|
+
|
16
|
+
require 'rubygems'
|
17
|
+
require 'rufus/mnemo'
|
18
|
+
|
19
|
+
p Rufus::Mnemo.from_integer(125704)
|
20
|
+
p Rufus::Mnemo.from_i(125704)
|
21
|
+
p Rufus::Mnemo.to_s(125704)
|
22
|
+
# => 'karasu'
|
23
|
+
|
24
|
+
p Rufus::Mnemo.to_integer('karasu')
|
25
|
+
p Rufus::Mnemo.to_i('karasu')
|
26
|
+
p Rufus::Mnemo.from_s('karasu')
|
27
|
+
# => 125704
|
28
|
+
|
29
|
+
|
30
|
+
## about negative integers ##
|
31
|
+
|
32
|
+
They are prefixed with the "wi" syllable (Thanks Stephan Wehner).
|
33
|
+
|
34
|
+
p Rufus::Mnemo.from_integer(-173866)
|
35
|
+
p Rufus::Mnemo.to_s(-173866)
|
36
|
+
# => 'winamote'
|
37
|
+
|
38
|
+
|
39
|
+
## ports in other languages ##
|
40
|
+
|
41
|
+
* PHP: https://github.com/aleksblendwerk/mnemo by Alexander Seltenreich
|
42
|
+
|
43
|
+
|
44
|
+
## dependencies ##
|
45
|
+
|
46
|
+
None.
|
47
|
+
|
48
|
+
|
49
|
+
## mailing list ##
|
50
|
+
|
51
|
+
On the rufus-ruby list:
|
52
|
+
|
53
|
+
http://groups.google.com/group/rufus-ruby
|
54
|
+
|
55
|
+
|
56
|
+
## IRC ##
|
57
|
+
|
58
|
+
On freenode.net, the #ruote channel
|
59
|
+
|
60
|
+
|
61
|
+
## issue tracker ##
|
62
|
+
|
63
|
+
https://github.com/jmettraux/rufus-mnemo/issues
|
64
|
+
|
65
|
+
|
66
|
+
## source ##
|
67
|
+
|
68
|
+
http://github.com/jmettraux/rufus-mnemo
|
69
|
+
|
70
|
+
|
71
|
+
## author ##
|
72
|
+
|
73
|
+
John Mettraux, jmettraux@gmail.com, http://lambda.io/jmettraux
|
74
|
+
|
75
|
+
|
76
|
+
## the rest of Rufus ##
|
77
|
+
|
78
|
+
http://rufus.rubyforge.org
|
79
|
+
|
80
|
+
|
81
|
+
## license ##
|
82
|
+
|
83
|
+
MIT
|
84
|
+
|
data/lib/rufus/mnemo.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2007-
|
2
|
+
# Copyright (c) 2007-2012, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -38,8 +38,8 @@ module Rufus
|
|
38
38
|
#
|
39
39
|
# Mnemo is meant to be used for generating human readable (or more
|
40
40
|
# easily rememberable) identifiers. Its first usage is within the
|
41
|
-
#
|
42
|
-
#
|
41
|
+
# ruote Ruby workflow engine for generating 'kawaii' business process
|
42
|
+
# instance ids.
|
43
43
|
#
|
44
44
|
# require 'rubygems'
|
45
45
|
# require 'rufus/mnemo'
|
@@ -68,7 +68,7 @@ module Rufus
|
|
68
68
|
#
|
69
69
|
module Mnemo
|
70
70
|
|
71
|
-
VERSION = '1.2.
|
71
|
+
VERSION = '1.2.3'
|
72
72
|
|
73
73
|
SYL = %w[
|
74
74
|
b d g h j k m n p r s t z
|
@@ -122,10 +122,9 @@ module Rufus
|
|
122
122
|
#
|
123
123
|
def self.split(word)
|
124
124
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
a_to_special(a)
|
125
|
+
a_to_special(
|
126
|
+
string_split(
|
127
|
+
from_special(word)))
|
129
128
|
end
|
130
129
|
|
131
130
|
# Returns if the string is a Mnemo word, like "fugu" or
|
@@ -152,7 +151,7 @@ module Rufus
|
|
152
151
|
|
153
152
|
def self.a_to_special(a)
|
154
153
|
|
155
|
-
a.collect { |syl| SPECIAL.
|
154
|
+
a.collect { |syl| (SPECIAL.assoc(syl) || [ nil, syl ])[1] }
|
156
155
|
end
|
157
156
|
|
158
157
|
def self.to_special(s)
|
data/rufus-mnemo.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
|
|
5
5
|
|
6
6
|
s.version = File.read(
|
7
7
|
File.expand_path('../lib/rufus/mnemo.rb', __FILE__)
|
8
|
-
).match(/VERSION *= *['"]([^'"]+)/)[1]
|
8
|
+
).match(/ VERSION *= *['"]([^'"]+)/)[1]
|
9
9
|
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.authors = [ 'John Mettraux' ]
|
data/test/test.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Sun Mar 18 13:29:37 JST 2007
|
6
6
|
#
|
7
7
|
|
8
|
-
$:.unshift(File.expand_path(
|
8
|
+
$:.unshift(File.expand_path('../../lib', __FILE__))
|
9
9
|
|
10
10
|
require 'test/unit'
|
11
11
|
require 'rufus/mnemo'
|
@@ -15,13 +15,7 @@ require 'rufus/mnemo'
|
|
15
15
|
#
|
16
16
|
class MnemoTest < Test::Unit::TestCase
|
17
17
|
|
18
|
-
|
19
|
-
#end
|
20
|
-
|
21
|
-
#def teardown
|
22
|
-
#end
|
23
|
-
|
24
|
-
def test_0
|
18
|
+
def test_from_integer
|
25
19
|
|
26
20
|
t = Time.now
|
27
21
|
#puts t.to_f
|
@@ -38,29 +32,25 @@ class MnemoTest < Test::Unit::TestCase
|
|
38
32
|
st2 = Rufus::Mnemo::to_integer(s)
|
39
33
|
s2 = Rufus::Mnemo::from_integer(st2)
|
40
34
|
|
41
|
-
#puts st
|
42
|
-
#puts s
|
43
|
-
|
44
|
-
#puts st2
|
45
|
-
#puts s2
|
46
|
-
|
47
35
|
assert_equal s, s2
|
48
36
|
assert_equal st, st2
|
37
|
+
end
|
49
38
|
|
50
|
-
|
39
|
+
def test_is_mnemo_word
|
51
40
|
|
52
|
-
|
41
|
+
assert Rufus::Mnemo::is_mnemo_word('takeshi')
|
53
42
|
|
54
|
-
|
55
|
-
|
43
|
+
assert Rufus::Mnemo::is_mnemo_word('tsunasima')
|
44
|
+
assert Rufus::Mnemo::is_mnemo_word('tunashima')
|
56
45
|
|
57
|
-
assert Rufus::Mnemo::is_mnemo_word(
|
46
|
+
assert (not Rufus::Mnemo::is_mnemo_word('dsfadf'))
|
47
|
+
assert (not Rufus::Mnemo::is_mnemo_word('takeshin'))
|
48
|
+
end
|
58
49
|
|
59
|
-
|
60
|
-
assert Rufus::Mnemo::is_mnemo_word("tunashima")
|
50
|
+
def test_split
|
61
51
|
|
62
|
-
|
63
|
-
|
52
|
+
assert_equal %w[ ko chi pi ga ], Rufus::Mnemo.split('kochipiga')
|
53
|
+
assert_equal %w[ ko na de tzu ], Rufus::Mnemo.split('konadetzu')
|
64
54
|
end
|
65
55
|
|
66
56
|
def test_zero
|
metadata
CHANGED
@@ -1,48 +1,40 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-mnemo
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
- 2
|
10
|
-
version: 1.2.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- John Mettraux
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-06-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: rake
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :development
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: ! "\nTurning (large) integers into japanese sounding words and vice versa\n
|
31
|
+
\ "
|
32
|
+
email:
|
38
33
|
- jmettraux@gmail.com
|
39
34
|
executables: []
|
40
|
-
|
41
35
|
extensions: []
|
42
|
-
|
43
36
|
extra_rdoc_files: []
|
44
|
-
|
45
|
-
files:
|
37
|
+
files:
|
46
38
|
- Rakefile
|
47
39
|
- lib/rufus/mnemo.rb
|
48
40
|
- lib/rufus-mnemo.rb
|
@@ -51,40 +43,29 @@ files:
|
|
51
43
|
- CHANGELOG.txt
|
52
44
|
- CREDITS.txt
|
53
45
|
- LICENSE.txt
|
54
|
-
- README.
|
55
|
-
has_rdoc: true
|
46
|
+
- README.md
|
56
47
|
homepage: http://github.com/jmettraux/rufus-mnemo/
|
57
48
|
licenses: []
|
58
|
-
|
59
49
|
post_install_message:
|
60
50
|
rdoc_options: []
|
61
|
-
|
62
|
-
require_paths:
|
51
|
+
require_paths:
|
63
52
|
- lib
|
64
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
54
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
|
70
|
-
|
71
|
-
- 0
|
72
|
-
version: "0"
|
73
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
60
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
|
79
|
-
segments:
|
80
|
-
- 0
|
81
|
-
version: "0"
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
82
65
|
requirements: []
|
83
|
-
|
84
66
|
rubyforge_project: rufus
|
85
|
-
rubygems_version: 1.
|
67
|
+
rubygems_version: 1.8.21
|
86
68
|
signing_key:
|
87
69
|
specification_version: 3
|
88
70
|
summary: Turning (large) integers into japanese sounding words and vice versa
|
89
71
|
test_files: []
|
90
|
-
|
data/README.rdoc
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
|
2
|
-
= rufus-mnemo
|
3
|
-
|
4
|
-
This gem provides methods for turning integer into easier to remember 'words' and vice-versa.
|
5
|
-
|
6
|
-
The module Rufus::Mnemo has all the explanation.
|
7
|
-
|
8
|
-
|
9
|
-
== getting it
|
10
|
-
|
11
|
-
gem install rufus-mnemo
|
12
|
-
|
13
|
-
|
14
|
-
== usage
|
15
|
-
|
16
|
-
require 'rubygems'
|
17
|
-
require 'rufus/mnemo'
|
18
|
-
|
19
|
-
p Rufus::Mnemo.from_integer(125704)
|
20
|
-
p Rufus::Mnemo.from_i(125704)
|
21
|
-
p Rufus::Mnemo.to_s(125704)
|
22
|
-
# => "karasu"
|
23
|
-
|
24
|
-
p Rufus::Mnemo.to_integer('karasu')
|
25
|
-
p Rufus::Mnemo.to_i('karasu')
|
26
|
-
p Rufus::Mnemo.from_s('karasu')
|
27
|
-
# => 125704
|
28
|
-
|
29
|
-
|
30
|
-
== about negative integers
|
31
|
-
|
32
|
-
They are prefixed with the "wi" syllable (Thanks Stephan Wehner).
|
33
|
-
|
34
|
-
p Rufus::Mnemo.from_integer(-173866)
|
35
|
-
p Rufus::Mnemo.to_s(-173866)
|
36
|
-
# => 'winamote'
|
37
|
-
|
38
|
-
|
39
|
-
= dependencies
|
40
|
-
|
41
|
-
None.
|
42
|
-
|
43
|
-
|
44
|
-
== mailing list
|
45
|
-
|
46
|
-
On the rufus-ruby list[http://groups.google.com/group/rufus-ruby] :
|
47
|
-
|
48
|
-
http://groups.google.com/group/rufus-ruby
|
49
|
-
|
50
|
-
|
51
|
-
== IRC
|
52
|
-
|
53
|
-
On freenode.net, the #ruote channel
|
54
|
-
|
55
|
-
|
56
|
-
== issue tracker
|
57
|
-
|
58
|
-
https://github.com/jmettraux/rufus-mnemo/issues
|
59
|
-
|
60
|
-
|
61
|
-
== source
|
62
|
-
|
63
|
-
http://github.com/jmettraux/rufus-mnemo
|
64
|
-
|
65
|
-
git checkout git://github.com/jmettraux/rufus-mnemo.git
|
66
|
-
|
67
|
-
|
68
|
-
== author
|
69
|
-
|
70
|
-
John Mettraux, jmettraux@gmail.com
|
71
|
-
http://jmettraux.wordpress.com
|
72
|
-
|
73
|
-
|
74
|
-
== the rest of Rufus
|
75
|
-
|
76
|
-
http://rufus.rubyforge.org
|
77
|
-
|
78
|
-
|
79
|
-
== license
|
80
|
-
|
81
|
-
MIT
|
82
|
-
|