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 ADDED
@@ -0,0 +1,13 @@
1
+ ---
2
+ language: ruby
3
+ rvm:
4
+ - 1.8.7
5
+ - 1.9.2
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - rbx-18mode
9
+ - rbx-19mode
10
+ - jruby-18mode
11
+ - jruby-19mode
12
+ - jruby-head
13
+ - ruby-head
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
@@ -1 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
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', '~> 2.13.0'
20
+ gem.add_development_dependency 'rspec'
21
+ gem.add_development_dependency 'rake'
21
22
  end
@@ -1,19 +1,40 @@
1
1
  module Gematria
2
2
  class English < Struct.new(:text)
3
- CORRESPONDENCE_TABLE = { # applies `mispar hechrachi` method to English alphabet (http://www.inner.org/gematria/fourways.php)
4
- a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9,
5
- j: 10, k: 20, l: 30, m: 40, n: 50, o: 60, p: 70, q: 80, r: 90,
6
- s: 100, t: 200, u: 300, v: 400, w: 500, x: 600, y: 700, z: 800
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
@@ -1,3 +1,3 @@
1
1
  module Gematria
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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
- version: 0.0.1
5
- prerelease:
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
- date: 2013-02-26 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
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
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 2.13.0
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
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 2.13.0
30
- description: A Ruby gem that calculates Gematria. This version supports English text
31
- and uses a mispar hechrachi style correspondence table, but in future versions there
32
- may be support for more languages as well as user configurable correspondence tables.
33
- The gem supports raw conversion to number (by simple summation), mapping (breakdown
34
- of individual numbers), and reduction to a single digit (mispar katan mispari).
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
- files:
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
- require_paths:
73
+
74
+ require_paths:
58
75
  - lib
59
- required_ruby_version: !ruby/object:Gem::Requirement
60
- none: false
61
- requirements:
62
- - - ! '>='
63
- - !ruby/object:Gem::Version
64
- version: '0'
65
- required_rubygems_version: !ruby/object:Gem::Requirement
66
- none: false
67
- requirements:
68
- - - ! '>='
69
- - !ruby/object:Gem::Version
70
- version: '0'
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.8.24
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