namo.rb 0.32.7 → 0.32.8
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/CHANGELOG +9 -0
- data/lib/Namo/Row.rb +3 -1
- data/lib/Namo/VERSION.rb +1 -1
- data/test/namo_test.rb +32 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4889db6dce5c63a9cc355e5b68611a33cb1dacbe94f678a6b11cd0a5c5c3fb0c
|
|
4
|
+
data.tar.gz: 561246d0002efb96b1235fbf7d64b20e4816217a78757477a2784a016e5a94c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 130de24b9419ccb107195ae5205dda09c5f46fd996dba9f38ea976a19619e9718cbb1d812810cf737571b955f1438e4651bfd6a39d5d5c8cf4a709b62cfb4596
|
|
7
|
+
data.tar.gz: c4c90a3798c7caf69e19c069979f423648c64fa8d53dd9122da8187d5d7e2db3f70d2e463d5b922ea61fe6d4fe53fc16cdc0cf1d98138a905f7603baf08a294f
|
data/CHANGELOG
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## 20261102
|
|
4
4
|
|
|
5
|
+
0.32.8: ~ Namo::Row#match?: A Range selects by cover?, so beginless and endless ranges of Dates and Strings select rather than raising TypeError.
|
|
6
|
+
|
|
7
|
+
1. ~ Namo::Row#match?: A Range is tested with cover? and an Array with include?, where both had been tested with include?, which raises for a beginless or endless range of anything not numeric. A bounded range of Strings now selects by ordering, as a bounded range of numbers already did, rather than by membership of its succ sequence.
|
|
8
|
+
2. + test/namo_test.rb: beginless and endless ranges of Dates and of Strings select; a two-arity formula windows over Dates.
|
|
9
|
+
3. ~ COMPARISON.md: - the note that the windowed formulae want numeric dates.
|
|
10
|
+
4. ~ comparison/namo_claims.rb: - the comment saying a beginless range of Dates raises.
|
|
11
|
+
5. ~ ROADMAP.md: + 0.32.8.
|
|
12
|
+
6. ~ Namo::VERSION: /0.32.7/0.32.8/
|
|
13
|
+
|
|
5
14
|
0.32.7: ~ COMPARISON.md: Verify and where necessary correct claims made about pandas, Polars, xarray, dplyr, and DataFrames.jl; + comparison/*_claims, which contain executable verification code.
|
|
6
15
|
|
|
7
16
|
1. + comparison/namo_claims.rb, pandas_claims.py, polars_claims.py, xarray_claims.py, dplyr_claims.R, dataframes_claims.jl: each runs every snippet COMPARISON.md shows for its tool, on inline data, then the probes behind its claims.
|
data/lib/Namo/Row.rb
CHANGED
|
@@ -27,8 +27,10 @@ class Namo
|
|
|
27
27
|
def match?(selections)
|
|
28
28
|
selections.all? do |dimension, coordinate|
|
|
29
29
|
case coordinate
|
|
30
|
-
when Array
|
|
30
|
+
when Array
|
|
31
31
|
coordinate.include?(self[dimension])
|
|
32
|
+
when Range
|
|
33
|
+
coordinate.cover?(self[dimension])
|
|
32
34
|
when Proc
|
|
33
35
|
coordinate.call(self[dimension])
|
|
34
36
|
when Regexp
|
data/lib/Namo/VERSION.rb
CHANGED
data/test/namo_test.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
require 'minitest/autorun'
|
|
2
2
|
require 'minitest-spec-context'
|
|
3
3
|
|
|
4
|
+
require 'date'
|
|
5
|
+
|
|
4
6
|
require_relative '../lib/namo'
|
|
5
7
|
|
|
6
8
|
module SupportedFlow
|
|
@@ -559,6 +561,36 @@ describe Namo do
|
|
|
559
561
|
_(sales[quantity: 100..].to_a.count).must_equal 2
|
|
560
562
|
end
|
|
561
563
|
|
|
564
|
+
it "supports beginless and endless ranges of Dates" do
|
|
565
|
+
dated = Namo.new([
|
|
566
|
+
{date: Date.new(2026, 1, 1), close: 1},
|
|
567
|
+
{date: Date.new(2026, 1, 2), close: 2},
|
|
568
|
+
{date: Date.new(2026, 1, 3), close: 3},
|
|
569
|
+
])
|
|
570
|
+
_(dated[date: ..Date.new(2026, 1, 2)].values(:close)).must_equal [1, 2]
|
|
571
|
+
_(dated[date: Date.new(2026, 1, 2)..].values(:close)).must_equal [2, 3]
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
it "supports beginless and endless ranges of Strings" do
|
|
575
|
+
dated = Namo.new([
|
|
576
|
+
{date: "2026-01-01", close: 1},
|
|
577
|
+
{date: "2026-01-02", close: 2},
|
|
578
|
+
{date: "2026-01-03", close: 3},
|
|
579
|
+
])
|
|
580
|
+
_(dated[date: .."2026-01-02"].values(:close)).must_equal [1, 2]
|
|
581
|
+
_(dated[date: "2026-01-02"..].values(:close)).must_equal [2, 3]
|
|
582
|
+
end
|
|
583
|
+
|
|
584
|
+
it "windows a two-arity formula over Dates" do
|
|
585
|
+
dated = Namo.new([
|
|
586
|
+
{date: Date.new(2026, 1, 1), close: 1},
|
|
587
|
+
{date: Date.new(2026, 1, 2), close: 2},
|
|
588
|
+
{date: Date.new(2026, 1, 3), close: 3},
|
|
589
|
+
])
|
|
590
|
+
dated[:running] = proc{|row, namo| namo[date: ..row[:date]].values(:close).sum}
|
|
591
|
+
_(dated.values(:running)).must_equal [1, 3, 6]
|
|
592
|
+
end
|
|
593
|
+
|
|
562
594
|
it "composes with projection in a single call" do
|
|
563
595
|
result = sales[:product, :quantity, quantity: 50..120]
|
|
564
596
|
_(result.to_a).must_equal [
|