foobara 0.0.110 → 0.0.111

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: 71a254889aa452b7a219cb8d9b4c7d1c2eb2c21ea452ae783e62d601720c387b
4
- data.tar.gz: 451cf0735d2c75026c92b92381e0e8a3766ed69a8a08eed739e6866e88f5b134
3
+ metadata.gz: 0ff2cd0b6537dbf44f0ef865a8fc6c8ac339d7b306cb67ddfcb744b74d2cb73d
4
+ data.tar.gz: cc3a822e6a43b1f2f27070c85fe2a4c07bc6a0274b963816fa3ef55bb531b597
5
5
  SHA512:
6
- metadata.gz: 6d758bae9e990d477c7775966b69dd1a51ae1878b938fec278a76ebbb8dd88a417e6c68f3a11174929cb86f858294bf1207206704bba70c458035e3798b12597
7
- data.tar.gz: 9f7c770b990f942884aaa79f45f7ce344aaabaa8a939536d869802c25ccc2ada3b7ddb476119a543d5546019874ae44929af29d5437d0574e447a4f8acc398ed
6
+ metadata.gz: 4f1a8853b814a569aeaa4ac67d53363fe5349658f9e9f8214f2c05d649154fcc6b60be0f249e2912485dbc0689ade4ae1e67e2e5b913f478ff8a4151756a1542
7
+ data.tar.gz: c52ccae166bf419ba503653a29aa4bde3b8094c2ba190f611e877eec13ada47bd787c448db5506def4f5cebb73748a215d4de0d2d6dc30325f5c110347ad12bd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [0.0.111] - 2025-04-25
2
+
3
+ - Fix bug in DomainMapper.depends_on
4
+ - Allow mutator instances to be used by connectors not just classes
5
+ - Some WeakObjectSet tweaks
6
+
1
7
  # [0.0.110] - 2025-04-23
2
8
 
3
9
  - Automatically load associations needed for delegated attributes for
@@ -59,7 +59,8 @@ module Foobara
59
59
  if subcommand_classes.empty?
60
60
  return @depends_on if defined?(@depends_on)
61
61
 
62
- @depends_on = if self == Foobara::Command
62
+ # TODO: get Command and DomainMapper out of here!
63
+ @depends_on = if self == Foobara::Command || self == Foobara::DomainMapper
63
64
  Set.new
64
65
  else
65
66
  superclass.depends_on.dup
@@ -122,8 +122,14 @@ module Foobara
122
122
 
123
123
  mutated_result_type = result_type
124
124
 
125
- response_mutators&.reverse&.each do |mutator|
126
- mutated_result_type = mutator.instance.result_type_from(mutated_result_type)
125
+ mutators = if response_mutators.size == 1
126
+ [response_mutator]
127
+ else
128
+ response_mutator&.processors&.reverse
129
+ end
130
+
131
+ mutators&.each do |mutator|
132
+ mutated_result_type = mutator.result_type_from(mutated_result_type)
127
133
  end
128
134
 
129
135
  @result_type_for_manifest = mutated_result_type
@@ -134,8 +140,14 @@ module Foobara
134
140
 
135
141
  mutated_inputs_type = inputs_type
136
142
 
137
- request_mutators&.each do |mutator|
138
- mutated_inputs_type = mutator.instance.inputs_type_from(mutated_inputs_type)
143
+ mutators = if request_mutators.size == 1
144
+ [request_mutator]
145
+ else
146
+ request_mutator&.processors&.reverse
147
+ end
148
+
149
+ mutators&.each do |mutator|
150
+ mutated_inputs_type = mutator.inputs_type_from(mutated_inputs_type)
139
151
  end
140
152
 
141
153
  @inputs_type_for_manifest = mutated_inputs_type
@@ -64,9 +64,6 @@ module Foobara
64
64
  end
65
65
 
66
66
  def updated(record)
67
- # Hacky way to handle situation where the primary key might have changed.
68
- # TODO: make a better way of handling this.
69
- tracked_records.delete(record)
70
67
  tracked_records << record
71
68
 
72
69
  # TODO: is this check redundant? Maybe have the entity explode directly instead?
@@ -519,8 +519,6 @@ module Foobara
519
519
 
520
520
  def flush_created!
521
521
  marked_created.each do |record|
522
- tracked_records.delete(record)
523
-
524
522
  flush_created_associations!(record)
525
523
 
526
524
  # TODO: do this in bulk
@@ -540,8 +538,6 @@ module Foobara
540
538
  end
541
539
 
542
540
  def flush_created_record!(record)
543
- tracked_records.delete(record)
544
-
545
541
  flush_created_associations!(record)
546
542
 
547
543
  unmark_created(record)
@@ -97,22 +97,40 @@ module Foobara
97
97
  end
98
98
 
99
99
  def <<(object)
100
- garbage_cleaner.track(object)
101
-
102
100
  object_id = object.object_id
103
101
 
104
- objects[object_id] = WeakRef.new(object)
102
+ if include?(object)
103
+ if @key_method
104
+ key = object.send(@key_method)
105
+ old_key = object_id_to_key[object_id]
105
106
 
106
- if @key_method
107
- key = object.send(@key_method)
107
+ if key != old_key
108
+ key_to_object_id.delete(old_key)
108
109
 
109
- if key
110
- key_to_object_id[key] = object_id
111
- object_id_to_key[object_id] = key
110
+ if key
111
+ key_to_object_id[key] = object_id
112
+ object_id_to_key[object_id] = key
113
+ else
114
+ object_id_to_key.delete(object_id)
115
+ end
116
+ end
112
117
  end
113
- end
118
+ else
119
+ garbage_cleaner.track(object)
114
120
 
115
- object
121
+ objects[object_id] = WeakRef.new(object)
122
+
123
+ if @key_method
124
+ key = object.send(@key_method)
125
+
126
+ if key
127
+ key_to_object_id[key] = object_id
128
+ object_id_to_key[object_id] = key
129
+ end
130
+ end
131
+
132
+ object
133
+ end
116
134
  end
117
135
 
118
136
  def include?(object_or_object_id)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.110
4
+ version: 0.0.111
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi