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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7adbe8192367d3c4207f7b27ff0b6a8a13f5243b42a4e4f18a6fbc35ef6439be
4
- data.tar.gz: cda1e8b3d8fc042b4457efc0bc7846d5a416a5eda670d140824a4f8ad193a0f2
3
+ metadata.gz: 9788cac0a828d1bb2dbe181bdc7a685a9d390ae452905a6a3cbec90d0af36a60
4
+ data.tar.gz: 27d4c652792e52e01c120e69268c790b8cc26bc2a5fcf884437e6320ef997723
5
5
  SHA512:
6
- metadata.gz: 60d639f243fc7bf306576b69ac646be388571b343330e5636f7c862519169cbaca3a36beb1cfccf16462b7e65b4735ca1b38e948db693c094c3636507531ebd4
7
- data.tar.gz: 5898c9f8b7d9196481a964826cee97a8f1a962916f818604fa4ea647c1b59d5b05e17ea0ac5a578c6cd2a7d499100d95a10344029e7b6abd5bce70a41efc9b1f
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
@@ -2,5 +2,5 @@
2
2
  # Namo::VERSION
3
3
 
4
4
  class Namo
5
- VERSION = '0.9.0'
5
+ VERSION = '0.9.1'
6
6
  end
data/lib/namo.rb CHANGED
@@ -12,11 +12,11 @@ class Namo
12
12
  attr_accessor :formulae
13
13
 
14
14
  def dimensions
15
- @data.first.keys + @formulae.keys
15
+ data_dimensions + derived_dimensions
16
16
  end
17
17
 
18
18
  def data_dimensions
19
- @data.first.keys
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 = nil, formulae: {})
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.0
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.11
95
+ rubygems_version: 4.0.12
96
96
  specification_version: 4
97
97
  summary: Named dimensional data for Ruby.
98
98
  test_files: []