gematria 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +13 -0
- data/CHANGELOG.md +18 -0
- data/README.md +6 -2
- data/Rakefile +6 -1
- data/gematria.gemspec +2 -1
- data/lib/gematria/english.rb +25 -4
- data/lib/gematria/version.rb +1 -1
- metadata +62 -42
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## v0.0.4 (far future)
|
2
|
+
|
3
|
+
### Todo
|
4
|
+
|
5
|
+
* Pluggable/Configurable correspondence tables
|
6
|
+
* Pluggable languages (DSL for new languages?)
|
7
|
+
|
8
|
+
## v0.0.3 (near future)
|
9
|
+
|
10
|
+
### Todo
|
11
|
+
|
12
|
+
* Make correspondence table into its own object
|
13
|
+
* Investigate feasability and worth of supporting Hebrew gematria
|
14
|
+
|
15
|
+
## v0.0.2
|
16
|
+
|
17
|
+
* Ruby 1.8.7 compatible
|
18
|
+
|
1
19
|
## v0.0.1
|
2
20
|
|
3
21
|
* initial release
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Gematria
|
1
|
+
# Gematria [![Build Status](https://travis-ci.org/adamzaninovich/gematria.png?branch=master)](https://travis-ci.org/adamzaninovich/gematria)
|
2
2
|
|
3
3
|
A Ruby gem that calculates Gematria. This version supports English text and uses a mispar hechrachi style correspondence table, but in future versions there may be support for more languages as well as user configurable correspondence tables. The gem supports raw conversion to number (by simple summation), mapping (breakdown of individual numbers), and reduction to a single digit (mispar katan mispari).
|
4
4
|
|
@@ -8,6 +8,10 @@ The current correspondence table is as follows:
|
|
8
8
|
j:10 k:20 l:30 m:40 n:50 o:60 p:70 q:80 r:90
|
9
9
|
s:100 t:200 u:300 v:400 w:500 x:600 y:700 z:800
|
10
10
|
|
11
|
+
## Documentation
|
12
|
+
|
13
|
+
Documentation at [rubydoc.info](http://rubydoc.info/github/adamzaninovich/gematria).
|
14
|
+
|
11
15
|
## Installation
|
12
16
|
|
13
17
|
Add this line to your application's Gemfile:
|
@@ -38,7 +42,7 @@ Or install it yourself as:
|
|
38
42
|
|
39
43
|
## Contributing
|
40
44
|
|
41
|
-
Please submit specs with your feature
|
45
|
+
Please submit documentation and specs with your feature.
|
42
46
|
|
43
47
|
1. Fork it
|
44
48
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
data/Rakefile
CHANGED
data/gematria.gemspec
CHANGED
@@ -17,5 +17,6 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_development_dependency 'rspec'
|
20
|
+
gem.add_development_dependency 'rspec'
|
21
|
+
gem.add_development_dependency 'rake'
|
21
22
|
end
|
data/lib/gematria/english.rb
CHANGED
@@ -1,19 +1,40 @@
|
|
1
1
|
module Gematria
|
2
2
|
class English < Struct.new(:text)
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
# applies "mispar hechrachi" method to English alphabet (http://www.inner.org/gematria/fourways.php)
|
4
|
+
CORRESPONDENCE_TABLE = {
|
5
|
+
:a => 1, :b => 2, :c => 3, :d => 4, :e => 5, :f => 6, :g => 7, :h => 8, :i => 9,
|
6
|
+
:j => 10, :k => 20, :l => 30, :m => 40, :n => 50, :o => 60, :p => 70, :q => 80, :r => 90,
|
7
|
+
:s => 100, :t => 200, :u => 300, :v => 400, :w => 500, :x => 600, :y => 700, :z => 800
|
7
8
|
}
|
8
9
|
|
10
|
+
# Gets an array of the values for each character of text.
|
11
|
+
#
|
12
|
+
# name = Gematria::English.new("Adam")
|
13
|
+
# name.mapped # => [1, 4, 1, 40]
|
14
|
+
#
|
15
|
+
# @return [Array<Number>] numerical values attributed to each character of the original text
|
9
16
|
def mapped
|
10
17
|
text.each_char.map { |c| lookup_char c }
|
11
18
|
end
|
12
19
|
|
20
|
+
# Gets the summed gematria number of text.
|
21
|
+
#
|
22
|
+
# name = Gematria::English.new("Adam")
|
23
|
+
# name.converted # => 46
|
24
|
+
#
|
25
|
+
# This uses <tt>mapped</tt> internally and sums the results.
|
26
|
+
# @return [Number] sum of the values of each character
|
13
27
|
def converted
|
14
28
|
mapped.inject(:+)
|
15
29
|
end
|
16
30
|
|
31
|
+
# Recursively reduces the <tt>converted</tt> value to a single digit mispar katan mispari style.
|
32
|
+
#
|
33
|
+
# name = Gematria::English.new("Adam")
|
34
|
+
# name.reduced # => 1
|
35
|
+
#
|
36
|
+
# For example: "Adam" -> 46 -> 10 -> 1
|
37
|
+
# @return [Number] single digit from reduction of <tt>converted</tt> value
|
17
38
|
def reduced
|
18
39
|
do_reduction_on converted
|
19
40
|
end
|
data/lib/gematria/version.rb
CHANGED
metadata
CHANGED
@@ -1,44 +1,58 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gematria
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Adam Zaninovich
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2013-02-26 00:00:00 -08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rspec
|
16
|
-
|
17
|
-
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
22
30
|
type: :development
|
31
|
+
version_requirements: *id001
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: rake
|
23
34
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
email:
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
segments:
|
40
|
+
- 0
|
41
|
+
version: "0"
|
42
|
+
type: :development
|
43
|
+
version_requirements: *id002
|
44
|
+
description: A Ruby gem that calculates Gematria. This version supports English text and uses a mispar hechrachi style correspondence table, but in future versions there may be support for more languages as well as user configurable correspondence tables. The gem supports raw conversion to number (by simple summation), mapping (breakdown of individual numbers), and reduction to a single digit (mispar katan mispari).
|
45
|
+
email:
|
36
46
|
- adam.zaninovich@gmail.com
|
37
47
|
executables: []
|
48
|
+
|
38
49
|
extensions: []
|
50
|
+
|
39
51
|
extra_rdoc_files: []
|
40
|
-
|
52
|
+
|
53
|
+
files:
|
41
54
|
- .gitignore
|
55
|
+
- .travis.yml
|
42
56
|
- CHANGELOG.md
|
43
57
|
- Gemfile
|
44
58
|
- LICENSE.txt
|
@@ -50,30 +64,36 @@ files:
|
|
50
64
|
- lib/gematria/version.rb
|
51
65
|
- spec/gematria/english_spec.rb
|
52
66
|
- spec/spec_helper.rb
|
67
|
+
has_rdoc: true
|
53
68
|
homepage: http://github.com/adamzaninovich/gematria
|
54
69
|
licenses: []
|
70
|
+
|
55
71
|
post_install_message:
|
56
72
|
rdoc_options: []
|
57
|
-
|
73
|
+
|
74
|
+
require_paths:
|
58
75
|
- lib
|
59
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
version: "0"
|
71
90
|
requirements: []
|
91
|
+
|
72
92
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.3.6
|
74
94
|
signing_key:
|
75
95
|
specification_version: 3
|
76
96
|
summary: A Ruby gem that calculates Gematria
|
77
|
-
test_files:
|
97
|
+
test_files:
|
78
98
|
- spec/gematria/english_spec.rb
|
79
99
|
- spec/spec_helper.rb
|