lexrb 0.0.2
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.
- checksums.yaml +7 -0
- data/lib/lexrb.rb +71 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c02ff804e4608e0834774ea22bbaf65d53ce8763
|
4
|
+
data.tar.gz: fcf6e2d61c425cf1f1e6dee5323fb05d1538decd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5ea7bc01a583a8fd93c0f67ab95e91d8ada748b84c577f313ad565add8144ed15677cfcdd1315457e0635c566e734c49b1c0f5959d7454442a577e0407ae6f2d
|
7
|
+
data.tar.gz: d977ce3eee699bce3f413c18901dd43a94e05669103c060434fc6db77d9fbceb658954924d6cab97f0259465469c410d4c6e57ab22eddc040fb3a4754e088ecd
|
data/lib/lexrb.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# A class to convert a given word in greek to
|
2
|
+
# a lexarithmic pythagorean number.
|
3
|
+
# Each letter corresponds to a specific number.
|
4
|
+
# You get the total word sum by adding each letter's number.
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# Author:: Zisis Maras (mailto:zisismaras@gmail.com)
|
8
|
+
# Copyright:: Copyright (c) 2013 Zisis Maras
|
9
|
+
# License:: Distributed under the MIT license
|
10
|
+
#
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
# >> lex = Lexrb.new
|
14
|
+
# >> lex.word = "ΑΒΓΔ"
|
15
|
+
# >> puts lex.calculate
|
16
|
+
# => 10
|
17
|
+
#
|
18
|
+
#
|
19
|
+
|
20
|
+
|
21
|
+
class Lexrb
|
22
|
+
|
23
|
+
attr_accessor :word , :sum
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
@sum = 0
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_array
|
30
|
+
@letter_array = @word.split(//)
|
31
|
+
end
|
32
|
+
|
33
|
+
def calculate
|
34
|
+
get_array
|
35
|
+
@letter_array.each do |letter|
|
36
|
+
@num = case letter
|
37
|
+
when "Α", "α", "ά" then 1
|
38
|
+
when "Β", "β" then 2
|
39
|
+
when "Γ", "γ" then 3
|
40
|
+
when "Δ", "δ" then 4
|
41
|
+
when "Ε", "ε", "έ" then 5
|
42
|
+
when "ς" then 6
|
43
|
+
when "Ζ", "ζ" then 7
|
44
|
+
when "Η", "η", "ή" then 8
|
45
|
+
when "Θ", "θ" then 9
|
46
|
+
when "Ι", "ι", "ί" then 10
|
47
|
+
when "Κ", "κ" then 20
|
48
|
+
when "Λ", "λ" then 30
|
49
|
+
when "Μ", "μ" then 40
|
50
|
+
when "Ν", "ν" then 50
|
51
|
+
when "Ξ", "ξ" then 60
|
52
|
+
when "Ο", "ο", "ό" then 70
|
53
|
+
when "Π", "π" then 80
|
54
|
+
when "Ρ", "ρ" then 100
|
55
|
+
when "Σ", "σ" then 200
|
56
|
+
when "Τ", "τ" then 300
|
57
|
+
when "Υ", "υ", "ύ" then 400
|
58
|
+
when "Φ", "φ" then 500
|
59
|
+
when "Χ", "χ" then 600
|
60
|
+
when "Ψ", "ψ" then 700
|
61
|
+
when "Ω", "ω", "ώ" then 800
|
62
|
+
else 0
|
63
|
+
end
|
64
|
+
@sum += @num
|
65
|
+
end
|
66
|
+
@sum
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lexrb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Zisis Maras
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: zisismaras@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/lexrb.rb
|
20
|
+
homepage:
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.0.7
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Words to pythagorean lexarithm converter
|
44
|
+
test_files: []
|