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.
- checksums.yaml +4 -4
- data/lib/fraction_tree/node.rb +12 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: deabc20b64c1bc3372116748312b3fae64358e0b482679a8dabd4892f30ec476
|
|
4
|
+
data.tar.gz: c45f3dfaf3e9cf537240ea4e917819d1561df0512a5453bebb1b1670a6dba03b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1c379848b03d35760dc9f0bb52f34c4202d832c836ab2def4359f979bf391dd5762253a85591b337a8591f73ee447a2099a7a81b292a795f904a38a3ec8db76
|
|
7
|
+
data.tar.gz: 4ffa8e474719f68c45bdf69627f912618ba056f1989b6f8da784b8eaba325f622347ac407b88f09d1885ff60eea383b76c7ed6ba45774adc70617726db3f76c0
|
data/lib/fraction_tree/node.rb
CHANGED
|
@@ -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.
|
|
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-
|
|
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.
|
|
153
|
+
rubygems_version: 4.0.11
|
|
154
154
|
specification_version: 4
|
|
155
155
|
summary: Fraction tree
|
|
156
156
|
test_files: []
|