nuva 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 391786d07b2a721da8b3c80f24937cd69c62221c0e67f0eaa2803ecbb243fe54
4
- data.tar.gz: 5e31145383cf0e4c70686d2f65121401f49465a4c72ca18f6cb2291085fdbd0e
3
+ metadata.gz: 84d3660a6ebaa46cbb7ada3f082a1c70cbfd12959ffb7e1d6357f07d4ac13f78
4
+ data.tar.gz: 0320eb55bbd40fbbcc7765eb581ae1c145ecaaab4aa5d10c80eddc3ac2c518e4
5
5
  SHA512:
6
- metadata.gz: f387e49eb07942ba3192aa92a34632662bc9fcf6ffaae18c5ea85225ea8a7c897f345fb3112c5c0c4795f4a8be540a4d7e49a7490abffd4ba19ce6ed09f5e860
7
- data.tar.gz: 26e0ba31d8834da784eae5da7915360caf1bc26f134c19875ddaef477fb7131b12e53b9547e8bb4daca21ca330d7ba315c833b1c26e08695ebe6ba76b24670c9
6
+ metadata.gz: 4b70148460f4282c9c4d9451a8bcb101f6ef1d6d57e071068f58fdfa647765c2f2d20ad4838b6ae0c5ec7a261fb670e7b677f00dccab405db2dd2ea39b8d2069
7
+ data.tar.gz: a08c9a736d9d25ec7634a6f7427f5f72e8dcd5dcb9dd7e8a16682057155b4339500280826c824020ed1b481dad0947ef923fd598c23a01e7d44a4783ee54c2d0
data/Changelog.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.0] - 2025-01-17
9
+
10
+ ### Added
11
+
12
+ - Support finding vaccines/diseases/valences by string uuid (not just symbol uuid)
13
+
14
+ ## [0.2.1] - 2025-01-17
15
+
16
+ ### Added
17
+
18
+ - Implement `inspect` method that does not print all data on repositories
19
+
8
20
  ## [0.2.0] - 2025-01-17
9
21
 
10
22
  ### Added
@@ -5,7 +5,7 @@ module Nuva
5
5
  def initialize(data)
6
6
  super data
7
7
  @ancestor_ids_by_id = {}
8
- @data.each_value do |valence|
8
+ @data_by_symbol_id.each_value do |valence|
9
9
  # Build hash of ancestor IDs for valence
10
10
  @ancestor_ids_by_id[valence.id] = lookup_ancestors(valence).uniq
11
11
  end
@@ -5,30 +5,33 @@ module Nuva
5
5
  attr_reader :data
6
6
 
7
7
  def initialize(data)
8
- @data = index_array_by_id(data)
9
- @data_by_code = data.each_with_object({}) { |item, acc| acc[item.code] = item }
8
+ @data_by_symbol_id =
9
+ data.each_with_object({}) { |item, acc| acc[item.id.to_sym] = item }
10
+ @data_by_string_id =
11
+ data.each_with_object({}) { |item, acc| acc[item.id.to_s] = item }
12
+ @data_by_code =
13
+ data.each_with_object({}) { |item, acc| acc[item.code] = item }
10
14
  end
11
15
 
12
16
  def find(id_or_code)
13
- @data_by_code[id_or_code] || @data[id_or_code]
17
+ @data_by_code[id_or_code] || @data_by_symbol_id[id_or_code] ||
18
+ @data_by_string_id[id_or_code]
14
19
  end
15
20
 
16
21
  def all
17
- @data.values
22
+ @data_by_symbol_id.values
18
23
  end
19
24
 
20
25
  def by_ids(ids)
21
26
  ids.map { |x| find x }.compact
22
27
  end
23
28
 
24
- private
25
-
26
- def index_array_by_id(array)
27
- array.each_with_object({}) { |item, acc| acc[item.id] = item }
29
+ def inspect
30
+ "#<#{self.class.name} count=#{@data_by_symbol_id.count}>"
28
31
  end
29
32
  end
30
33
  end
31
34
 
32
- require_relative 'repositories/disease_repository'
33
- require_relative 'repositories/vaccine_repository'
34
- require_relative 'repositories/valence_repository'
35
+ require_relative "repositories/disease_repository"
36
+ require_relative "repositories/vaccine_repository"
37
+ require_relative "repositories/valence_repository"
data/lib/nuva/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nuva
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nuva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Syadem