namo 0.9.0 → 0.9.1
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/VERSION.rb +1 -1
- data/lib/namo.rb +3 -3
- data/test/namo_test.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9788cac0a828d1bb2dbe181bdc7a685a9d390ae452905a6a3cbec90d0af36a60
|
|
4
|
+
data.tar.gz: 27d4c652792e52e01c120e69268c790b8cc26bc2a5fcf884437e6320ef997723
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cad1474b8d4f14cb8ffc98fc718bd0a047ea5fa9fb0c00a6da1e3c058345f6ab88d20e0a569bd7fb838ba0ad8ea43769b46f86b675e994f8d513766da76e9a94
|
|
7
|
+
data.tar.gz: 1974cdebe247dc73dd8b62c70297ba928c51f41954ba1913b8709cb4183bc556fc2d44c334763d4984238015f6dc2ce1c962bbe65aff9de8111a0926e13626bd
|
data/CHANGELOG
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
CHANGELOG
|
|
2
2
|
_________
|
|
3
3
|
|
|
4
|
+
20260525
|
|
5
|
+
0.9.1: ~ Namo#initialize: default data to [], ~ Namo#data_dimensions to handle empty data
|
|
6
|
+
|
|
7
|
+
1. ~ Namo#initialize: Default `data` parameter changed from `nil` to `[]`. Construction with no arguments now produces a usable empty Namo rather than one whose introspection methods crash on `nil`.
|
|
8
|
+
2. ~ Namo#data_dimensions: Handle empty `@data` with `@data.first&.keys || []`. Returns `[]` for a Namo with no rows instead of raising `NoMethodError` on `nil.keys`.
|
|
9
|
+
3. ~ Namo#dimensions: Refactor to delegate as `data_dimensions + derived_dimensions`. The empty-case guard now lives in one place; `dimensions` becomes a trivial composition.
|
|
10
|
+
4. ~ test/namo_test.rb: + Empty-Namo tests (dimensions, data_dimensions, formula surfacing on a Namo with no data).
|
|
11
|
+
5. ~ Namo::VERSION: /0.9.0/0.9.1/
|
|
12
|
+
|
|
4
13
|
20260521
|
|
5
14
|
0.9.0: + composition operators: equi-join (*), Cartesian product (**), decomposition (/)
|
|
6
15
|
|
data/lib/Namo/VERSION.rb
CHANGED
data/lib/namo.rb
CHANGED
|
@@ -12,11 +12,11 @@ class Namo
|
|
|
12
12
|
attr_accessor :formulae
|
|
13
13
|
|
|
14
14
|
def dimensions
|
|
15
|
-
|
|
15
|
+
data_dimensions + derived_dimensions
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def data_dimensions
|
|
19
|
-
@data.first
|
|
19
|
+
@data.first&.keys || []
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def derived_dimensions
|
|
@@ -249,7 +249,7 @@ class Namo
|
|
|
249
249
|
end
|
|
250
250
|
end
|
|
251
251
|
|
|
252
|
-
def initialize(data =
|
|
252
|
+
def initialize(data = [], formulae: {})
|
|
253
253
|
@data = data
|
|
254
254
|
@formulae = formulae
|
|
255
255
|
end
|
data/test/namo_test.rb
CHANGED
|
@@ -17,6 +17,22 @@ describe Namo do
|
|
|
17
17
|
Namo.new(sample_data)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
describe "empty Namo" do
|
|
21
|
+
it "has empty dimensions" do
|
|
22
|
+
_(Namo.new.dimensions).must_equal []
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "has empty data_dimensions" do
|
|
26
|
+
_(Namo.new.data_dimensions).must_equal []
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "exposes formulae even with no data" do
|
|
30
|
+
namo = Namo.new
|
|
31
|
+
namo[:x] = proc{|r| 42}
|
|
32
|
+
_(namo.dimensions).must_equal [:x]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
20
36
|
describe "#dimensions" do
|
|
21
37
|
it "infers dimensions from hash keys" do
|
|
22
38
|
_(sales.dimensions).must_equal [:product, :quarter, :price, :quantity]
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: namo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thoran
|
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
93
|
version: '0'
|
|
94
94
|
requirements: []
|
|
95
|
-
rubygems_version: 4.0.
|
|
95
|
+
rubygems_version: 4.0.12
|
|
96
96
|
specification_version: 4
|
|
97
97
|
summary: Named dimensional data for Ruby.
|
|
98
98
|
test_files: []
|