destiny_matrix 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b7c69d031dd66416eaf2aaa7b13deb3c0b0f6ef79b987b89eb512cdfeaaff2b6
4
+ data.tar.gz: 0f481aa0f61ca7f866fcaec13c58eb0d6a17bbccb357d4c8a96976ce889bacbd
5
+ SHA512:
6
+ metadata.gz: 702dcc3c8bec34d6fb0bde34bdd93c650c2a16a80e3e35da7e85a8e20ea2cddd368c13753307f94f33d0bb29b659adf77296bb50d75e25bed0ad74cb9a43791e
7
+ data.tar.gz: 52f09dbe8a04b33dd7c65dc150fc0c55bc0c9e31c4275fa9d135f2283fdb99edc1db0df9934fc140e24c35b6fcd53dd9167d0d22777ba177000320b5ac1c059d
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wsgtcyx
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Destiny Matrix (Ruby)
2
+
3
+ A small Ruby library to compute Destiny Matrix personal points and derived structures
4
+ (`years`, `purposes`, `chart_heart`) from a birth date.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ gem install destiny_matrix
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```ruby
15
+ require 'destiny_matrix'
16
+
17
+ result = DestinyMatrix::Calculator.calculate(day: 1, month: 1, year: 1990)
18
+
19
+ result.points[:apoint] # => 1
20
+ result.purposes[:skypoint] # => 22
21
+ result.chart_heart[:sahphysics]
22
+ result.years[:afpoint]
23
+ ```
24
+
25
+ ## API
26
+
27
+ - `DestinyMatrix::Calculator.calculate(day:, month:, year:)` returns a `DestinyMatrix::Result`
28
+ - `DestinyMatrix::Calculator.points(day:, month:, year:)` returns only the points hash
29
+ - `DestinyMatrix::Calculator.reduce_number(number)` and `calculate_year(year)` are exposed for parity
30
+
31
+ The computation logic mirrors the Destiny Matrix calculation used on the website.
32
+
33
+ ## License
34
+
35
+ MIT
@@ -0,0 +1,308 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DestinyMatrix
4
+ Result = Struct.new(:points, :purposes, :chart_heart, :years, keyword_init: true)
5
+
6
+ class Calculator
7
+ class << self
8
+ def calculate(day:, month:, year:)
9
+ day_value = coerce_integer(day, 'day')
10
+ month_value = coerce_integer(month, 'month')
11
+ year_value = coerce_integer(year, 'year')
12
+
13
+ validate_date_parts!(day_value, month_value, year_value)
14
+
15
+ apoint = reduce_number(day_value)
16
+ bpoint = month_value
17
+ cpoint = calculate_year(year_value)
18
+
19
+ calculate_from_points(apoint, bpoint, cpoint)
20
+ end
21
+
22
+ def points(day:, month:, year:)
23
+ calculate(day: day, month: month, year: year).points
24
+ end
25
+
26
+ def reduce_number(number)
27
+ num = number
28
+ if number > 22
29
+ num = (number % 10) + (number / 10).floor
30
+ end
31
+ num
32
+ end
33
+
34
+ def calculate_year(year)
35
+ y = 0
36
+ value = year
37
+ while value > 0
38
+ y += value % 10
39
+ value /= 10
40
+ end
41
+ reduce_number(y)
42
+ end
43
+
44
+ private
45
+
46
+ def coerce_integer(value, label)
47
+ Integer(value)
48
+ rescue ArgumentError, TypeError
49
+ raise ArgumentError, "#{label} must be an integer"
50
+ end
51
+
52
+ def validate_date_parts!(day, month, year)
53
+ unless day >= 1 && day <= 31
54
+ raise ArgumentError, 'day must be between 1 and 31'
55
+ end
56
+ unless month >= 1 && month <= 12
57
+ raise ArgumentError, 'month must be between 1 and 12'
58
+ end
59
+ unless year >= 0
60
+ raise ArgumentError, 'year must be greater than or equal to 0'
61
+ end
62
+ end
63
+
64
+ def calculate_from_points(a_point, b_point, c_point)
65
+ dpoint = reduce_number(a_point + b_point + c_point)
66
+ epoint = reduce_number(a_point + b_point + c_point + dpoint)
67
+ fpoint = reduce_number(a_point + b_point)
68
+ gpoint = reduce_number(b_point + c_point)
69
+ hpoint = reduce_number(dpoint + a_point)
70
+ ipoint = reduce_number(c_point + dpoint)
71
+ jpoint = reduce_number(dpoint + epoint)
72
+
73
+ npoint = reduce_number(c_point + epoint)
74
+ lpoint = reduce_number(jpoint + npoint)
75
+ mpoint = reduce_number(lpoint + npoint)
76
+ kpoint = reduce_number(jpoint + lpoint)
77
+
78
+ qpoint = reduce_number(npoint + c_point)
79
+ rpoint = reduce_number(jpoint + dpoint)
80
+ spoint = reduce_number(a_point + epoint)
81
+ tpoint = reduce_number(b_point + epoint)
82
+
83
+ opoint = reduce_number(a_point + spoint)
84
+ ppoint = reduce_number(b_point + tpoint)
85
+
86
+ upoint = reduce_number(fpoint + gpoint + hpoint + ipoint)
87
+ vpoint = reduce_number(epoint + upoint)
88
+ wpoint = reduce_number(spoint + epoint)
89
+ xpoint = reduce_number(tpoint + epoint)
90
+
91
+ f2point = reduce_number(fpoint + upoint)
92
+ f1point = reduce_number(fpoint + f2point)
93
+ g2point = reduce_number(gpoint + upoint)
94
+ g1point = reduce_number(gpoint + g2point)
95
+ i2point = reduce_number(ipoint + upoint)
96
+ i1point = reduce_number(ipoint + i2point)
97
+ h2point = reduce_number(hpoint + upoint)
98
+ h1point = reduce_number(hpoint + h2point)
99
+
100
+ afpoint = reduce_number(a_point + fpoint)
101
+ af1point = reduce_number(a_point + afpoint)
102
+ af2point = reduce_number(a_point + af1point)
103
+ af3point = reduce_number(afpoint + af1point)
104
+ af4point = reduce_number(afpoint + fpoint)
105
+ af5point = reduce_number(afpoint + af4point)
106
+ af6point = reduce_number(af4point + fpoint)
107
+
108
+ fbpoint = reduce_number(fpoint + b_point)
109
+ fb1point = reduce_number(fpoint + fbpoint)
110
+ fb2point = reduce_number(fpoint + fb1point)
111
+ fb3point = reduce_number(fbpoint + fb1point)
112
+ fb4point = reduce_number(fbpoint + b_point)
113
+ fb5point = reduce_number(fbpoint + fb4point)
114
+ fb6point = reduce_number(fb4point + b_point)
115
+
116
+ bgpoint = reduce_number(b_point + gpoint)
117
+ bg1point = reduce_number(b_point + bgpoint)
118
+ bg2point = reduce_number(b_point + bg1point)
119
+ bg3point = reduce_number(bgpoint + bg1point)
120
+ bg4point = reduce_number(bgpoint + gpoint)
121
+ bg5point = reduce_number(bgpoint + bg4point)
122
+ bg6point = reduce_number(bg4point + gpoint)
123
+
124
+ gcpoint = reduce_number(gpoint + c_point)
125
+ gc1point = reduce_number(gpoint + gcpoint)
126
+ gc2point = reduce_number(gpoint + gc1point)
127
+ gc3point = reduce_number(gcpoint + gc1point)
128
+ gc4point = reduce_number(gcpoint + c_point)
129
+ gc5point = reduce_number(gcpoint + gc4point)
130
+ gc6point = reduce_number(gc4point + c_point)
131
+
132
+ cipoint = reduce_number(c_point + ipoint)
133
+ ci1point = reduce_number(c_point + cipoint)
134
+ ci2point = reduce_number(c_point + ci1point)
135
+ ci3point = reduce_number(cipoint + ci1point)
136
+ ci4point = reduce_number(cipoint + ipoint)
137
+ ci5point = reduce_number(cipoint + ci4point)
138
+ ci6point = reduce_number(ci4point + ipoint)
139
+
140
+ idpoint = reduce_number(ipoint + dpoint)
141
+ id1point = reduce_number(ipoint + idpoint)
142
+ id2point = reduce_number(ipoint + id1point)
143
+ id3point = reduce_number(idpoint + id1point)
144
+ id4point = reduce_number(idpoint + dpoint)
145
+ id5point = reduce_number(idpoint + id4point)
146
+ id6point = reduce_number(id4point + dpoint)
147
+
148
+ dhpoint = reduce_number(dpoint + hpoint)
149
+ dh1point = reduce_number(dpoint + dhpoint)
150
+ dh2point = reduce_number(dpoint + dh1point)
151
+ dh3point = reduce_number(dhpoint + dh1point)
152
+ dh4point = reduce_number(dhpoint + hpoint)
153
+ dh5point = reduce_number(dhpoint + dh4point)
154
+ dh6point = reduce_number(dh4point + hpoint)
155
+
156
+ hapoint = reduce_number(hpoint + a_point)
157
+ ha1point = reduce_number(hpoint + hapoint)
158
+ ha2point = reduce_number(hpoint + ha1point)
159
+ ha3point = reduce_number(hapoint + ha1point)
160
+ ha4point = reduce_number(hapoint + a_point)
161
+ ha5point = reduce_number(hapoint + ha4point)
162
+ ha6point = reduce_number(ha4point + a_point)
163
+
164
+ skypoint = reduce_number(b_point + dpoint)
165
+ earthpoint = reduce_number(a_point + c_point)
166
+ perspurpose = reduce_number(skypoint + earthpoint)
167
+ femalepoint = reduce_number(gpoint + hpoint)
168
+ malepoint = reduce_number(fpoint + ipoint)
169
+ socialpurpose = reduce_number(femalepoint + malepoint)
170
+ generalpurpose = reduce_number(perspurpose + socialpurpose)
171
+ planetarypurpose = reduce_number(socialpurpose + generalpurpose)
172
+
173
+ points = {
174
+ apoint: a_point,
175
+ bpoint: b_point,
176
+ cpoint: c_point,
177
+ dpoint: dpoint,
178
+ epoint: epoint,
179
+ fpoint: fpoint,
180
+ gpoint: gpoint,
181
+ hpoint: hpoint,
182
+ ipoint: ipoint,
183
+ jpoint: jpoint,
184
+ kpoint: kpoint,
185
+ lpoint: lpoint,
186
+ mpoint: mpoint,
187
+ npoint: npoint,
188
+ opoint: opoint,
189
+ ppoint: ppoint,
190
+ qpoint: qpoint,
191
+ rpoint: rpoint,
192
+ spoint: spoint,
193
+ tpoint: tpoint,
194
+ upoint: upoint,
195
+ vpoint: vpoint,
196
+ wpoint: wpoint,
197
+ xpoint: xpoint,
198
+ f2point: f2point,
199
+ f1point: f1point,
200
+ g2point: g2point,
201
+ g1point: g1point,
202
+ i2point: i2point,
203
+ i1point: i1point,
204
+ h2point: h2point,
205
+ h1point: h1point
206
+ }
207
+
208
+ purposes = {
209
+ skypoint: skypoint,
210
+ earthpoint: earthpoint,
211
+ perspurpose: perspurpose,
212
+ femalepoint: femalepoint,
213
+ malepoint: malepoint,
214
+ socialpurpose: socialpurpose,
215
+ generalpurpose: generalpurpose,
216
+ planetarypurpose: planetarypurpose
217
+ }
218
+
219
+ chart_heart = {
220
+ sahphysics: a_point,
221
+ ajphysics: opoint,
222
+ vishphysics: spoint,
223
+ anahphysics: wpoint,
224
+ manphysics: epoint,
225
+ svadphysics: jpoint,
226
+ mulphysics: c_point,
227
+
228
+ sahenergy: b_point,
229
+ ajenergy: ppoint,
230
+ vishenergy: tpoint,
231
+ anahenergy: xpoint,
232
+ manenergy: epoint,
233
+ svadenergy: npoint,
234
+ mulenergy: dpoint,
235
+
236
+ sahemotions: reduce_number(a_point + b_point),
237
+ ajemotions: reduce_number(opoint + ppoint),
238
+ vishemotions: reduce_number(spoint + tpoint),
239
+ anahemotions: reduce_number(wpoint + xpoint),
240
+ manemotions: reduce_number(epoint + epoint),
241
+ svademotions: reduce_number(jpoint + npoint),
242
+ mulemotions: reduce_number(c_point + dpoint)
243
+ }
244
+
245
+ years = {
246
+ afpoint: afpoint,
247
+ af1point: af1point,
248
+ af2point: af2point,
249
+ af3point: af3point,
250
+ af4point: af4point,
251
+ af5point: af5point,
252
+ af6point: af6point,
253
+ fbpoint: fbpoint,
254
+ fb1point: fb1point,
255
+ fb2point: fb2point,
256
+ fb3point: fb3point,
257
+ fb4point: fb4point,
258
+ fb5point: fb5point,
259
+ fb6point: fb6point,
260
+ bgpoint: bgpoint,
261
+ bg1point: bg1point,
262
+ bg2point: bg2point,
263
+ bg3point: bg3point,
264
+ bg4point: bg4point,
265
+ bg5point: bg5point,
266
+ bg6point: bg6point,
267
+ gcpoint: gcpoint,
268
+ gc1point: gc1point,
269
+ gc2point: gc2point,
270
+ gc3point: gc3point,
271
+ gc4point: gc4point,
272
+ gc5point: gc5point,
273
+ gc6point: gc6point,
274
+ cipoint: cipoint,
275
+ ci1point: ci1point,
276
+ ci2point: ci2point,
277
+ ci3point: ci3point,
278
+ ci4point: ci4point,
279
+ ci5point: ci5point,
280
+ ci6point: ci6point,
281
+ idpoint: idpoint,
282
+ id1point: id1point,
283
+ id2point: id2point,
284
+ id3point: id3point,
285
+ id4point: id4point,
286
+ id5point: id5point,
287
+ id6point: id6point,
288
+ dhpoint: dhpoint,
289
+ dh1point: dh1point,
290
+ dh2point: dh2point,
291
+ dh3point: dh3point,
292
+ dh4point: dh4point,
293
+ dh5point: dh5point,
294
+ dh6point: dh6point,
295
+ hapoint: hapoint,
296
+ ha1point: ha1point,
297
+ ha2point: ha2point,
298
+ ha3point: ha3point,
299
+ ha4point: ha4point,
300
+ ha5point: ha5point,
301
+ ha6point: ha6point
302
+ }
303
+
304
+ Result.new(points: points, purposes: purposes, chart_heart: chart_heart, years: years)
305
+ end
306
+ end
307
+ end
308
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DestinyMatrix
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'destiny_matrix/version'
4
+ require_relative 'destiny_matrix/calculator'
5
+
6
+ module DestinyMatrix
7
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: destiny_matrix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - wsgtcyx
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-02-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Compute Destiny Matrix personal points and derived structures (years,
14
+ purposes, chart heart).
15
+ email:
16
+ - 439248005@qq.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - LICENSE.txt
22
+ - README.md
23
+ - lib/destiny_matrix.rb
24
+ - lib/destiny_matrix/calculator.rb
25
+ - lib/destiny_matrix/version.rb
26
+ homepage: https://destiny-matrix.cc/
27
+ licenses:
28
+ - MIT
29
+ metadata:
30
+ homepage_uri: https://destiny-matrix.cc/
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '3.2'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubygems_version: 3.0.3.1
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: Destiny Matrix personal calculation utilities.
50
+ test_files: []