num_decouverte_personnalite 26.1.0
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/.idea/.gitignore +10 -0
- data/.idea/modules.xml +8 -0
- data/.idea/num_decouverte_personalite.iml +43 -0
- data/.idea/vcs.xml +6 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +12 -0
- data/lib/num_decouverte_personnalite/version.rb +5 -0
- data/lib/num_decouverte_personnalite.rb +350 -0
- data/run_lib.sh +6 -0
- data/sig/.DS_Store +0 -0
- data/sig/num_decouverte_personnalite.rbs +59 -0
- data/sig/test_num_decouverte_personnalite.rbs +13 -0
- metadata +57 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7be7aa524e3c0dfdd099036dbf2ff30c9f603c79ab197e90b9e1cc7a4d71733e
|
|
4
|
+
data.tar.gz: 3a34787ab3a14d3f317d60847870f71fa3a39ed3d0fb486e4e7fa83164e48f79
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7a3a923d7c490d14d9228a7b9ca94e48c29dc4adcab20e401e1fc0d4b86d8741c8213d1f1f80f2a92efb96009007bb5ca094f02e59d1087e14dd407a47921066
|
|
7
|
+
data.tar.gz: 566bca67e818103f264cff00b46b92436bc1cc117eafb330293b4db7a73cfba6050dcf513becf3f871208bd0a6606cf6bf2ccb9dca31d75ab69d8ca8e1f1f9d0
|
data/.idea/.gitignore
ADDED
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/num_decouverte_personalite.iml" filepath="$PROJECT_DIR$/.idea/num_decouverte_personalite.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
|
4
|
+
<shared />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="NewModuleRootManager">
|
|
7
|
+
<content url="file://$MODULE_DIR$/../num_decouverte_personnalite">
|
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/../num_decouverte_personnalite/features" isTestSource="true" />
|
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/../num_decouverte_personnalite/spec" isTestSource="true" />
|
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/../num_decouverte_personnalite/test" isTestSource="true" />
|
|
11
|
+
</content>
|
|
12
|
+
<orderEntry type="jdk" jdkName="rbenv: 4.0.1" jdkType="RUBY_SDK" />
|
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.3, rbenv: 4.0.1) [gem]" level="application" />
|
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v4.0.3, rbenv: 4.0.1) [gem]" level="application" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="erb (v6.0.5, rbenv: 4.0.1) [gem]" level="application" />
|
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="io-console (v0.8.2, rbenv: 4.0.1) [gem]" level="application" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="irb (v1.18.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.21.1, rbenv: 4.0.1) [gem]" level="application" />
|
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.6, rbenv: 4.0.1) [gem]" level="application" />
|
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="lint_roller (v1.1.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="logger (v1.7.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.27.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v2.1.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v3.3.12.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="pp (v0.6.4, rbenv: 4.0.1) [gem]" level="application" />
|
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="prettyprint (v0.2.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="prism (v1.9.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, rbenv: 4.0.1) [gem]" level="application" />
|
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 4.0.1) [gem]" level="application" />
|
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.4.2, rbenv: 4.0.1) [gem]" level="application" />
|
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="rbs (v4.0.3, rbenv: 4.0.1) [gem]" level="application" />
|
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="rdoc (v8.0.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.12.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="reline (v0.6.3, rbenv: 4.0.1) [gem]" level="application" />
|
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.88.2, rbenv: 4.0.1) [gem]" level="application" />
|
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.50.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="tsort (v0.2.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v3.2.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-emoji (v4.2.0, rbenv: 4.0.1) [gem]" level="application" />
|
|
42
|
+
</component>
|
|
43
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
"num_decouverte_personalite" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
|
|
4
|
+
|
|
5
|
+
* Participants will be tolerant of opposing views.
|
|
6
|
+
* Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
|
|
7
|
+
* When interpreting the words and actions of others, participants should always assume good intentions.
|
|
8
|
+
* Behaviour which can be reasonably considered harassment will not be tolerated.
|
|
9
|
+
|
|
10
|
+
If you have any concerns about behaviour within this project, please contact us at ["stephane@bressani.dev"](mailto:"stephane@bressani.dev").
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 stephaneworkspace
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# NumDecouvertePersonalite
|
|
2
|
+
|
|
3
|
+
TODO: Delete this and the text below, and describe your gem
|
|
4
|
+
|
|
5
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/num_decouverte_personalite`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
|
10
|
+
|
|
11
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
TODO: Write usage instructions here
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/num_decouverte_personalite. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/num_decouverte_personalite/blob/main/CODE_OF_CONDUCT.md).
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
40
|
+
|
|
41
|
+
## Code of Conduct
|
|
42
|
+
|
|
43
|
+
Everyone interacting in the NumDecouvertePersonalite project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/num_decouverte_personalite/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "num_decouverte_personnalite/version"
|
|
4
|
+
|
|
5
|
+
module NumDecouvertePersonnalite
|
|
6
|
+
class Error < StandardError; end
|
|
7
|
+
|
|
8
|
+
EtatCivil = Struct.new(
|
|
9
|
+
:valeur,
|
|
10
|
+
:voyelle,
|
|
11
|
+
:consonne,
|
|
12
|
+
:tout,
|
|
13
|
+
keyword_init: true
|
|
14
|
+
)
|
|
15
|
+
ChaineCaractere = Struct.new(
|
|
16
|
+
:nombre_presentation,
|
|
17
|
+
:nombre_reduit,
|
|
18
|
+
:ligne_caractere_vers_chiffre,
|
|
19
|
+
:valeur,
|
|
20
|
+
:resultat,
|
|
21
|
+
keyword_init: true
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# Génération des caractères unicode, sauf ce qui n'est pas associable à l'alphabet
|
|
25
|
+
def self.generate_unicode_valeurs
|
|
26
|
+
hash = {}
|
|
27
|
+
|
|
28
|
+
(0..0x10FFFF).each do |code|
|
|
29
|
+
lettre = code.chr(Encoding::UTF_8) rescue next
|
|
30
|
+
|
|
31
|
+
normalise = lettre
|
|
32
|
+
.unicode_normalize(:nfkd)
|
|
33
|
+
.gsub(/\p{Mn}/, "")
|
|
34
|
+
.upcase
|
|
35
|
+
|
|
36
|
+
next unless normalise.match?(/\A[A-Z]\z/)
|
|
37
|
+
|
|
38
|
+
hash[lettre] = VALEURS[normalise]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
hash
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
VALEURS = {
|
|
45
|
+
"A" => 1, "B" => 2, "C" => 3, "D" => 4, "E" => 5, "F" => 6, "G" => 7, "H" => 8, "I" => 9,
|
|
46
|
+
"J" => 1, "K" => 2, "L" => 3, "M" => 4, "N" => 5, "O" => 6, "P" => 7, "Q" => 8, "R" => 9,
|
|
47
|
+
"S" => 1, "T" => 2, "U" => 3, "V" => 4, "W" => 5, "X" => 6, "Y" => 7, "Z" => 8
|
|
48
|
+
# Accents
|
|
49
|
+
# "É" => 1, "È" => 1, "Ê" => 1, "Ë" => 1, "Ç" => 1,
|
|
50
|
+
# "Û" => 3, "Ü" => 3,
|
|
51
|
+
# "Î" => 5,
|
|
52
|
+
# "Ô" => 6, "Ö" => 6,
|
|
53
|
+
# "Â" => 9, "À" => 9
|
|
54
|
+
}.freeze
|
|
55
|
+
|
|
56
|
+
TOUS_LES_VALEURS = generate_unicode_valeurs.freeze
|
|
57
|
+
|
|
58
|
+
NOMBRE = {
|
|
59
|
+
1 => "1",
|
|
60
|
+
2 => "2",
|
|
61
|
+
3 => "3",
|
|
62
|
+
4 => "4",
|
|
63
|
+
5 => "5",
|
|
64
|
+
6 => "6",
|
|
65
|
+
7 => "7",
|
|
66
|
+
8 => "8",
|
|
67
|
+
9 => "9"
|
|
68
|
+
}.freeze
|
|
69
|
+
|
|
70
|
+
MAITRE_NOMBRE = {
|
|
71
|
+
11 => "11/2", # "\e[34m#{nombre}\e[0m" bleu
|
|
72
|
+
22 => "22/4",
|
|
73
|
+
33 => "33/6"
|
|
74
|
+
}.freeze
|
|
75
|
+
|
|
76
|
+
NOMBRE_KARMIQUE = {
|
|
77
|
+
13 => "13/4", # "\e[31m#{nombre}\e[0m" # rouge
|
|
78
|
+
14 => "14/5",
|
|
79
|
+
16 => "16/7",
|
|
80
|
+
19 => "19/1",
|
|
81
|
+
}.freeze
|
|
82
|
+
|
|
83
|
+
# Génère tous les nombres de 12 à max dont la réduction théosophique directe (somme des chiffres)
|
|
84
|
+
# donne un résultat entre 1 et 9, en excluant les nombres maîtres et karmiques.
|
|
85
|
+
# Les nombres comme 28 (2+8=10), 91 (9+1=10), etc. sont ignorés, car leur première
|
|
86
|
+
# réduction ne donne pas directement 1 à 9 !
|
|
87
|
+
def self.generate_octave(max = 10_000)
|
|
88
|
+
exclus = MAITRE_NOMBRE.keys + NOMBRE_KARMIQUE.keys
|
|
89
|
+
(12..max).each_with_object({}) do |n, hash|
|
|
90
|
+
next if exclus.include?(n)
|
|
91
|
+
somme = n.digits.sum
|
|
92
|
+
next if somme > 9
|
|
93
|
+
hash[n] = "#{n}/#{somme}"
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
OCTAVE = generate_octave.freeze
|
|
98
|
+
|
|
99
|
+
TOUS_LES_NOMBRES = {
|
|
100
|
+
**NOMBRE,
|
|
101
|
+
**MAITRE_NOMBRE,
|
|
102
|
+
**NOMBRE_KARMIQUE,
|
|
103
|
+
**OCTAVE
|
|
104
|
+
}.freeze
|
|
105
|
+
|
|
106
|
+
module Nature
|
|
107
|
+
VOYELLE = :voyelle
|
|
108
|
+
CONSONNE = :consonne
|
|
109
|
+
TOUT = :tout
|
|
110
|
+
ALL = [VOYELLE, CONSONNE, TOUT].freeze
|
|
111
|
+
end
|
|
112
|
+
# gem "num_decouverte_personalite", path: "/chemin/vers/num_decouverte_personalite"
|
|
113
|
+
#---
|
|
114
|
+
# bundle install
|
|
115
|
+
#---
|
|
116
|
+
# require "num_decouverte_personalite"
|
|
117
|
+
#
|
|
118
|
+
# puts HelloLib.transform("Stéphane")
|
|
119
|
+
#---
|
|
120
|
+
# publier: gem build num_decouverte_personalite.gemspec
|
|
121
|
+
# puis: gem push num_decouverte_personalite-0.1.0.gem
|
|
122
|
+
def self.etat_civil(prenom_actif, prenom_secondaire, nom_de_famille)
|
|
123
|
+
result = [
|
|
124
|
+
*self.separate(prenom_actif),
|
|
125
|
+
*self.separate(prenom_secondaire),
|
|
126
|
+
*self.separate(nom_de_famille)
|
|
127
|
+
]
|
|
128
|
+
etat_civil = []
|
|
129
|
+
result.each { |x|
|
|
130
|
+
etat_civil.push(
|
|
131
|
+
EtatCivil.new(
|
|
132
|
+
valeur: x,
|
|
133
|
+
voyelle: self.chaine_de_caractere_individuelle(x, :voyelle).resultat,
|
|
134
|
+
consonne: self.chaine_de_caractere_individuelle(x, :consonne).resultat,
|
|
135
|
+
tout: self.chaine_de_caractere_individuelle(x, :tout).resultat
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
# puts etat_civil
|
|
140
|
+
etat_civil
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def self.grille_inclusion(prenom_actif, prenom_secondaire, nom_de_famille)
|
|
144
|
+
result = [
|
|
145
|
+
*self.separate(prenom_actif),
|
|
146
|
+
*self.separate(prenom_secondaire),
|
|
147
|
+
*self.separate(nom_de_famille)
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
chaine = result.join
|
|
151
|
+
|
|
152
|
+
# Compteur des nombres 1 à 9
|
|
153
|
+
compteur = Hash.new(0)
|
|
154
|
+
|
|
155
|
+
chaine.each_char do |lettre|
|
|
156
|
+
valeur = TOUS_LES_VALEURS[lettre.upcase]
|
|
157
|
+
compteur[valeur] += 1 if valeur
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Grille 3x3
|
|
161
|
+
[
|
|
162
|
+
[compteur[1], compteur[2], compteur[3]],
|
|
163
|
+
[compteur[4], compteur[5], compteur[6]],
|
|
164
|
+
[compteur[7], compteur[8], compteur[9]]
|
|
165
|
+
]
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def self.stat(prenom_actif, prenom_secondaire, nom_de_famille, type)
|
|
169
|
+
etat_civil = self.etat_civil(prenom_actif, prenom_secondaire, nom_de_famille)
|
|
170
|
+
count = 0
|
|
171
|
+
etat_civil.each do |x|
|
|
172
|
+
resultat =
|
|
173
|
+
case type
|
|
174
|
+
when Nature::VOYELLE
|
|
175
|
+
x.voyelle
|
|
176
|
+
when Nature::CONSONNE
|
|
177
|
+
x.consonne
|
|
178
|
+
# when Nature::TOUT
|
|
179
|
+
else
|
|
180
|
+
x.tout
|
|
181
|
+
end
|
|
182
|
+
i = self.extrait_nombre(resultat.last[0])
|
|
183
|
+
# puts "#{x.valeur}: #{i}"
|
|
184
|
+
count += i
|
|
185
|
+
end
|
|
186
|
+
# puts count
|
|
187
|
+
nombre_avec_dash = self::TOUS_LES_NOMBRES[count]
|
|
188
|
+
if nombre_avec_dash == nil
|
|
189
|
+
nombre_avec_dash = count.to_s
|
|
190
|
+
end
|
|
191
|
+
res = 0
|
|
192
|
+
loop do
|
|
193
|
+
if count < 9
|
|
194
|
+
res = count.to_s
|
|
195
|
+
break
|
|
196
|
+
end
|
|
197
|
+
if nombre_avec_dash.include?("/")
|
|
198
|
+
res = nombre_avec_dash
|
|
199
|
+
break
|
|
200
|
+
end
|
|
201
|
+
nv_s = self.niveau_superieur(count.to_s)
|
|
202
|
+
if nv_s[:final]
|
|
203
|
+
res = nv_s[:octave]
|
|
204
|
+
break
|
|
205
|
+
else
|
|
206
|
+
count = nv_s[:sum]
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
# puts res
|
|
210
|
+
res
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
class << self
|
|
214
|
+
private
|
|
215
|
+
|
|
216
|
+
# Divise une entrée en plusieurs parties en utilisant des espaces et des tirets comme séparateurs.
|
|
217
|
+
def separate(string)
|
|
218
|
+
string.split(/[\s-]+/)
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def valeur_lettre(lettre)
|
|
222
|
+
TOUS_LES_VALEURS[lettre.upcase]
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
def niveau_1(string, nature)
|
|
226
|
+
raise ArgumentError unless Nature::ALL.include?(nature)
|
|
227
|
+
string.chars.map do |lettre|
|
|
228
|
+
est_voyelle = %w[A E I O U Y É È Ê Ë Â À].include?(lettre.upcase)
|
|
229
|
+
if nature == Nature::VOYELLE && est_voyelle
|
|
230
|
+
valeur_lettre(lettre) || "_"
|
|
231
|
+
elsif nature == Nature::CONSONNE && !est_voyelle
|
|
232
|
+
valeur_lettre(lettre) || "_"
|
|
233
|
+
elsif nature == Nature::TOUT
|
|
234
|
+
valeur_lettre(lettre) || "_"
|
|
235
|
+
else
|
|
236
|
+
"_"
|
|
237
|
+
end
|
|
238
|
+
end.join
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
def extract_niveau(niveau_precedant)
|
|
242
|
+
if niveau_precedant.match?(/[A-Za-zÀ-ÿ]/)
|
|
243
|
+
niveau_precedant.scan(/\d+/).map(&:to_i)
|
|
244
|
+
else
|
|
245
|
+
if niveau_precedant.include?("/")
|
|
246
|
+
niveau_precedant.split("/").map(&:to_i)
|
|
247
|
+
else
|
|
248
|
+
niveau_precedant.scan(/\d/).map(&:to_i)
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def theosophique(nombre)
|
|
254
|
+
while nombre > 9
|
|
255
|
+
nombre = nombre.digits.sum
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
nombre
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def niveau_superieur(niveau_precedant)
|
|
262
|
+
all = self::TOUS_LES_NOMBRES
|
|
263
|
+
sum = self.extract_niveau(niveau_precedant).sum
|
|
264
|
+
|
|
265
|
+
if MAITRE_NOMBRE.key?(sum) || NOMBRE_KARMIQUE.key?(sum) || OCTAVE.key?(sum)
|
|
266
|
+
{
|
|
267
|
+
sum: sum,
|
|
268
|
+
last: self.theosophique(sum),
|
|
269
|
+
octave: all[sum],
|
|
270
|
+
final: true
|
|
271
|
+
}
|
|
272
|
+
elsif sum >= 1 && sum <= 9
|
|
273
|
+
{
|
|
274
|
+
sum: sum,
|
|
275
|
+
last: sum,
|
|
276
|
+
octave: all[sum],
|
|
277
|
+
final: true
|
|
278
|
+
}
|
|
279
|
+
else
|
|
280
|
+
{
|
|
281
|
+
sum: sum,
|
|
282
|
+
last: nil,
|
|
283
|
+
octave: sum.to_s,
|
|
284
|
+
final: false
|
|
285
|
+
}
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def chaine_de_caractere_individuelle(string, nature)
|
|
290
|
+
hash = {
|
|
291
|
+
presentation: nil,
|
|
292
|
+
nombre_reduit: 0,
|
|
293
|
+
ligne_caractere_vers_chiffre: ""
|
|
294
|
+
}
|
|
295
|
+
niveau = self.niveau_1(
|
|
296
|
+
string,
|
|
297
|
+
nature
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
niveaux = [niveau]
|
|
301
|
+
loop do
|
|
302
|
+
resultat = self.niveau_superieur(niveau)
|
|
303
|
+
niveaux << resultat
|
|
304
|
+
hash[:presentation] = resultat[:octave]
|
|
305
|
+
hash[:nombre_reduit] = resultat[:last]
|
|
306
|
+
break if resultat[:final]
|
|
307
|
+
niveau = resultat[:sum].to_s
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
resultat = []
|
|
311
|
+
niveaux.each_with_index do | n, index|
|
|
312
|
+
if index == 0
|
|
313
|
+
line = []
|
|
314
|
+
line.push(n)
|
|
315
|
+
# puts "#{index} - #{n}"
|
|
316
|
+
line.push(:base)
|
|
317
|
+
else
|
|
318
|
+
# puts "#{index} - #{n}"
|
|
319
|
+
line = []
|
|
320
|
+
line.push(n[:octave])
|
|
321
|
+
if n.is_a?(Hash) && n.key?(:last) && n[:last] != nil
|
|
322
|
+
line.push(:final)
|
|
323
|
+
else
|
|
324
|
+
line.push(:intermediaire)
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
resultat.push(line)
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
ChaineCaractere.new(
|
|
331
|
+
nombre_presentation: hash[:presentation],
|
|
332
|
+
nombre_reduit: hash[:nombre_reduit],
|
|
333
|
+
ligne_caractere_vers_chiffre: niveaux.first,
|
|
334
|
+
valeur: string,
|
|
335
|
+
resultat: resultat
|
|
336
|
+
)
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
# Pour la méthode stat
|
|
340
|
+
def extrait_nombre(nombre)
|
|
341
|
+
valeur = nombre.to_s
|
|
342
|
+
|
|
343
|
+
if valeur.include?("/")
|
|
344
|
+
valeur.split("/").last.to_i
|
|
345
|
+
else
|
|
346
|
+
valeur.to_i
|
|
347
|
+
end
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
end
|
data/run_lib.sh
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -e
|
|
3
|
+
bundle install
|
|
4
|
+
bundle exec rake test | grep -v "Finished in"
|
|
5
|
+
#bundle exec ruby -Ilib -e 'require "num_decouverte_personnalite"; puts NumDecouvertePersonnalite.chaine_de_caractere_individuelle("Stéphane", NumDecouvertePersonnalite::Nature::VOYELLE)'
|
|
6
|
+
#bundle exec ruby -Ilib -e 'require "num_decouverte_personnalite"; puts NumDecouvertePersonnalite.niveau_1("Stéphane", NumDecouvertePersonnalite::Nature::VOYELLE)'
|
data/sig/.DS_Store
ADDED
|
Binary file
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module NumDecouvertePersonnalite
|
|
2
|
+
class EtatCivil
|
|
3
|
+
attr_reader valeur: String
|
|
4
|
+
attr_reader voyelle: Array[Array[String | Symbol]]
|
|
5
|
+
attr_reader consonne: Array[Array[String | Symbol]]
|
|
6
|
+
attr_reader tout: Array[Array[String | Symbol]]
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class ChaineCaractere
|
|
10
|
+
attr_reader nombre_presentation: String?
|
|
11
|
+
attr_reader nombre_reduit: Integer?
|
|
12
|
+
attr_reader ligne_caractere_vers_chiffre: String
|
|
13
|
+
attr_reader valeur: String
|
|
14
|
+
attr_reader resultat: Array[Array[String | Symbol]]
|
|
15
|
+
end
|
|
16
|
+
TOUS_LES_VALEURS: Hash[String, Integer]
|
|
17
|
+
|
|
18
|
+
module Nature
|
|
19
|
+
VOYELLE: Symbol
|
|
20
|
+
CONSONNE: Symbol
|
|
21
|
+
TOUT: Symbol
|
|
22
|
+
ALL: Array[Symbol]
|
|
23
|
+
end
|
|
24
|
+
MAITRE_NOMBRE: Hash[Integer, String]
|
|
25
|
+
NOMBRE: Hash[Integer, String]
|
|
26
|
+
NOMBRE_KARMIQUE: Hash[Integer, String]
|
|
27
|
+
OCTAVE: Hash[Integer, String]
|
|
28
|
+
TOUS_LES_NOMBRES: Hash[Integer, String]
|
|
29
|
+
VERSION: String
|
|
30
|
+
VALEURS: Hash[String, Integer]
|
|
31
|
+
|
|
32
|
+
def self.chaine_de_caractere_individuelle: (String, Symbol) -> ChaineCaractere
|
|
33
|
+
|
|
34
|
+
def self.etat_civil: (String, String, String) -> Array[EtatCivil]
|
|
35
|
+
|
|
36
|
+
def self.extract_niveau: (String) -> Array[Integer]
|
|
37
|
+
|
|
38
|
+
def self.generate_octave: -> Hash[Integer, String]
|
|
39
|
+
|
|
40
|
+
def self.generate_unicode_valeurs: -> Hash[String, Integer]
|
|
41
|
+
|
|
42
|
+
def self.grille_inclusion: -> Array[Array[Integer]]
|
|
43
|
+
|
|
44
|
+
def self.niveau_1: (String, Symbol) -> String
|
|
45
|
+
|
|
46
|
+
def self.niveau_superieur: (String) -> Hash[Symbol, Integer | String | bool | nil]
|
|
47
|
+
|
|
48
|
+
def self.separate: (String) -> Array[String]
|
|
49
|
+
|
|
50
|
+
def self.theosophique: (Integer) -> Integer
|
|
51
|
+
|
|
52
|
+
def self.transform: (String, String, String) -> Array[String]
|
|
53
|
+
|
|
54
|
+
def self.valeur_lettre: (String) -> Integer?
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
def self.extrait_nombre: -> Integer
|
|
59
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class TestNumDecouvertePersonnalite
|
|
2
|
+
def test_it_does_something_useful: -> Void
|
|
3
|
+
|
|
4
|
+
def test_it_separates_correctly: -> Void
|
|
5
|
+
|
|
6
|
+
def test_octave: -> Void
|
|
7
|
+
|
|
8
|
+
def test_that_it_has_a_version_number: -> Void
|
|
9
|
+
|
|
10
|
+
def test_lettre: -> Void
|
|
11
|
+
|
|
12
|
+
def test_vibration_de_noms: -> Void
|
|
13
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: num_decouverte_personnalite
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 26.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- stephaneworkspace
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: Etude de la personnalite numérologique
|
|
13
|
+
email:
|
|
14
|
+
- stephane@bressani.dev
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- ".idea/.gitignore"
|
|
20
|
+
- ".idea/modules.xml"
|
|
21
|
+
- ".idea/num_decouverte_personalite.iml"
|
|
22
|
+
- ".idea/vcs.xml"
|
|
23
|
+
- CODE_OF_CONDUCT.md
|
|
24
|
+
- LICENSE.txt
|
|
25
|
+
- README.md
|
|
26
|
+
- Rakefile
|
|
27
|
+
- lib/num_decouverte_personnalite.rb
|
|
28
|
+
- lib/num_decouverte_personnalite/version.rb
|
|
29
|
+
- run_lib.sh
|
|
30
|
+
- sig/.DS_Store
|
|
31
|
+
- sig/num_decouverte_personnalite.rbs
|
|
32
|
+
- sig/test_num_decouverte_personnalite.rbs
|
|
33
|
+
homepage: https://github.com/stephaneworkspace/num_decouverte_personnalite
|
|
34
|
+
licenses:
|
|
35
|
+
- MIT
|
|
36
|
+
metadata:
|
|
37
|
+
homepage_uri: https://github.com/stephaneworkspace/num_decouverte_personnalite
|
|
38
|
+
source_code_uri: https://github.com/stephaneworkspace/num_decouverte_personnalite
|
|
39
|
+
changelog_uri: https://github.com/stephaneworkspace/num_decouverte_personnalite/blob/main/CHANGELOG.md
|
|
40
|
+
rdoc_options: []
|
|
41
|
+
require_paths:
|
|
42
|
+
- lib
|
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 3.2.0
|
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '0'
|
|
53
|
+
requirements: []
|
|
54
|
+
rubygems_version: 4.0.3
|
|
55
|
+
specification_version: 4
|
|
56
|
+
summary: Utilitaire pour la numérologie
|
|
57
|
+
test_files: []
|