inferno_core 1.0.5 → 1.0.6

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.
@@ -1,4 +1,5 @@
1
- require_relative 'result_collection'
1
+ require_relative 'dsl/result_collection'
2
+
2
3
  module Inferno
3
4
  # @private
4
5
  # This class takes an array of results and determines the overall result. This
@@ -1,4 +1,4 @@
1
1
  module Inferno
2
2
  # Standard patterns for gem versions: https://guides.rubygems.org/patterns/
3
- VERSION = '1.0.5'.freeze
3
+ VERSION = '1.0.6'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inferno_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-07-24 00:00:00.000000000 Z
13
+ date: 2025-07-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -526,6 +526,7 @@ files:
526
526
  - lib/inferno/apps/cli/templates/docs/_Footer.md
527
527
  - lib/inferno/apps/cli/templates/docs/_Sidebar.md
528
528
  - lib/inferno/apps/cli/templates/lib/%library_name%.rb.tt
529
+ - lib/inferno/apps/cli/templates/lib/%library_name%/.DS_Store
529
530
  - lib/inferno/apps/cli/templates/lib/%library_name%/example_suite.rb.tt
530
531
  - lib/inferno/apps/cli/templates/lib/%library_name%/example_suite/patient_group.rb.tt
531
532
  - lib/inferno/apps/cli/templates/lib/%library_name%/igs/.keep
@@ -536,6 +537,7 @@ files:
536
537
  Template.xlsx
537
538
  - lib/inferno/apps/cli/templates/lib/%library_name%/suite.rb.tt
538
539
  - lib/inferno/apps/cli/templates/lib/%library_name%/version.rb.tt
540
+ - lib/inferno/apps/cli/templates/lib/.DS_Store
539
541
  - lib/inferno/apps/cli/templates/run.sh
540
542
  - lib/inferno/apps/cli/templates/setup.sh
541
543
  - lib/inferno/apps/cli/templates/spec/%library_name%/patient_group_spec.rb.tt
@@ -648,6 +650,7 @@ files:
648
650
  - lib/inferno/dsl/primitive_type.rb
649
651
  - lib/inferno/dsl/request_storage.rb
650
652
  - lib/inferno/dsl/requirement_set.rb
653
+ - lib/inferno/dsl/result_collection.rb
651
654
  - lib/inferno/dsl/results.rb
652
655
  - lib/inferno/dsl/resume_test_route.rb
653
656
  - lib/inferno/dsl/runnable.rb
@@ -720,7 +723,6 @@ files:
720
723
  - lib/inferno/repositories/tests.rb
721
724
  - lib/inferno/repositories/validate_runnable_reference.rb
722
725
  - lib/inferno/repositories/validator_sessions.rb
723
- - lib/inferno/result_collection.rb
724
726
  - lib/inferno/result_summarizer.rb
725
727
  - lib/inferno/route_storage.rb
726
728
  - lib/inferno/spec_support.rb
@@ -1,72 +0,0 @@
1
- module Inferno
2
- # The ResultCollection class is used to manage a collection of Inferno::Entities::Result objects.
3
- # It provides methods to filter required and optional results, access results
4
- # by index or by their runnable IDs, and iterate over the collection.
5
- #
6
- # @example
7
- #
8
- # results = [
9
- # Result.new(test_group_id: 'group_id1', result: 'pass'),
10
- # Result.new(test_group_id: 'group_id2', result: 'fail'),
11
- # Result.new(test_group_id: 'group_id3', result: 'pass')
12
- # ]
13
- #
14
- # result_collection = Inferno::ResultCollection.new(results)
15
- #
16
- # # Access by index
17
- # result = result_collection[0]
18
- #
19
- # # Access by runnable ID (partial)
20
- # result = result_collection['group_id2']
21
- #
22
- # # Iterate over results
23
- # result_collection.each do |result|
24
- # puts result.result
25
- # end
26
- #
27
- # # Get required results
28
- # required_results = result_collection.required_results
29
- #
30
- # # Get optional results
31
- # optional_results = result_collection.optional_results
32
- # @private
33
- class ResultCollection
34
- include Enumerable
35
-
36
- attr_reader :results
37
-
38
- def initialize(results = [])
39
- @results = results
40
- end
41
-
42
- def [](key)
43
- key.is_a?(Integer) ? results[key] : lookup_by_runnable_id(key)
44
- end
45
-
46
- def <<(result)
47
- (results << result).flatten!
48
- self
49
- end
50
-
51
- def each(&)
52
- return to_enum(:each) unless block_given?
53
-
54
- results.each(&)
55
- self
56
- end
57
-
58
- def required_results
59
- results.select(&:required?)
60
- end
61
-
62
- def optional_results
63
- results.select(&:optional?)
64
- end
65
-
66
- private
67
-
68
- def lookup_by_runnable_id(key)
69
- results.find { |result| result.runnable&.id == key.to_s || result.runnable&.id&.end_with?("-#{key}") }
70
- end
71
- end
72
- end