namo 0.9.0 → 0.9.2

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: 2959666eaa2d603b1877d42863ddadae9e021aceb753a60009579a2dbe2d7aa4
4
+ data.tar.gz: ac865863705a2ca58c815eed073227a39ebb479358fea0590e4f76a5f6b0813c
5
5
  SHA512:
6
- metadata.gz: 60d639f243fc7bf306576b69ac646be388571b343330e5636f7c862519169cbaca3a36beb1cfccf16462b7e65b4735ca1b38e948db693c094c3636507531ebd4
7
- data.tar.gz: 5898c9f8b7d9196481a964826cee97a8f1a962916f818604fa4ea647c1b59d5b05e17ea0ac5a578c6cd2a7d499100d95a10344029e7b6abd5bce70a41efc9b1f
6
+ metadata.gz: '09cc42eba9f306b4316a70140bb9642dc025c39d4bc3a502b21bee28058709b8b55609093d9979e27e2799d1bdad1efd60d829a71931502abc8e7cde71f1a1c7'
7
+ data.tar.gz: 3952f6470d2f5dc8aeb733034d8c7cbf6214b909453f3b26e7ac29480388b79d345efba1ff925ce4617c64c7a9c2f1e578f2e8938f2e51def0d378109f65d276
data/CHANGELOG CHANGED
@@ -1,6 +1,21 @@
1
1
  CHANGELOG
2
2
  _________
3
3
 
4
+ 20260525
5
+ 0.9.2: ~ Auto-load Namo::VERSION
6
+
7
+ 1. ~ lib/namo.rb: + `require_relative './Namo/VERSION'`. Namo::VERSION is now defined when `namo` is required, without needing a separate require.
8
+ 2. ~ Namo::VERSION: /0.9.1/0.9.2/
9
+
10
+ 20260525
11
+ 0.9.1: ~ Namo#initialize: default data to [], ~ Namo#data_dimensions to handle empty data
12
+
13
+ 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`.
14
+ 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`.
15
+ 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.
16
+ 4. ~ test/namo_test.rb: + Empty-Namo tests (dimensions, data_dimensions, formula surfacing on a Namo with no data).
17
+ 5. ~ Namo::VERSION: /0.9.0/0.9.1/
18
+
4
19
  20260521
5
20
  0.9.0: + composition operators: equi-join (*), Cartesian product (**), decomposition (/)
6
21
 
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.2'
6
6
  end
data/lib/namo.rb CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  require_relative './Namo/NegatedDimension'
5
5
  require_relative './Namo/Row'
6
+ require_relative './Namo/VERSION'
6
7
  require_relative './Symbol'
7
8
 
8
9
  class Namo
@@ -12,11 +13,11 @@ class Namo
12
13
  attr_accessor :formulae
13
14
 
14
15
  def dimensions
15
- @data.first.keys + @formulae.keys
16
+ data_dimensions + derived_dimensions
16
17
  end
17
18
 
18
19
  def data_dimensions
19
- @data.first.keys
20
+ @data.first&.keys || []
20
21
  end
21
22
 
22
23
  def derived_dimensions
@@ -249,7 +250,7 @@ class Namo
249
250
  end
250
251
  end
251
252
 
252
- def initialize(data = nil, formulae: {})
253
+ def initialize(data = [], formulae: {})
253
254
  @data = data
254
255
  @formulae = formulae
255
256
  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.2
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: []