fraction-tree 2.1.3 → 2.2.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fraction_tree/node.rb +12 -0
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c93c771b15dc11f618cc27bff33524f7feb80bdf1310c811f53db3de5898c015
4
- data.tar.gz: c40130bcc10af5a231b559d70911f728b41ee755b02e7b740fbd33fc1bb0323f
3
+ metadata.gz: deabc20b64c1bc3372116748312b3fae64358e0b482679a8dabd4892f30ec476
4
+ data.tar.gz: c45f3dfaf3e9cf537240ea4e917819d1561df0512a5453bebb1b1670a6dba03b
5
5
  SHA512:
6
- metadata.gz: f4c530b0352f93e6b8d94d302fcb178190c82946b072c2810cab3f941fbafbba432c9e789a444a87c74afeb729d33aca60871cdd309092ff7dab4c589fc28d75
7
- data.tar.gz: 32ad67a615865017e466dc5f421492ecb3df40039477ea020aecbff648342fb2f9a24d70e6ddf2baf6fbeb8a761620d4f53741da8c56a4eb9493df7643a9b10a
6
+ metadata.gz: c1c379848b03d35760dc9f0bb52f34c4202d832c836ab2def4359f979bf391dd5762253a85591b337a8591f73ee447a2099a7a81b292a795f904a38a3ec8db76
7
+ data.tar.gz: 4ffa8e474719f68c45bdf69627f912618ba056f1989b6f8da784b8eaba325f622347ac407b88f09d1885ff60eea383b76c7ed6ba45774adc70617726db3f76c0
@@ -159,6 +159,18 @@ class FractionTree
159
159
  path & tree.node(num).path
160
160
  end
161
161
 
162
+ # @return [FractionTree::Node] the nearest common ancestor of self and the given number
163
+ # @example
164
+ # FractionTree.node(4/3r).nearest_common_ancestor_with(7/4r)
165
+ # => (3/2)
166
+ #
167
+ # @param num [Numeric] other number sharing descendants with self
168
+ #
169
+ def nearest_common_ancestor_with(num)
170
+ common_ancestors_with(num).last
171
+ end
172
+ alias :nca_with :nearest_common_ancestor_with
173
+
162
174
  # @return [Array] of fraction tree nodes, descending from parents of number
163
175
  # @example
164
176
  # FractionTree.node(5/4r).descendancy_from(depth: 3)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fraction-tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Hales-Garcia
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-01-27 00:00:00.000000000 Z
10
+ date: 2026-05-04 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: matrix
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '3.1'
152
152
  requirements: []
153
- rubygems_version: 4.0.4
153
+ rubygems_version: 4.0.11
154
154
  specification_version: 4
155
155
  summary: Fraction tree
156
156
  test_files: []