Class: Upkeep::Dependencies::Identity
- Inherits:
-
Base
- Object
- Base
- Upkeep::Dependencies::Identity
show all
- Defined in:
- lib/upkeep/dependencies.rb
Instance Attribute Summary
Attributes inherited from Base
#key, #metadata, #source
Instance Method Summary
collapse
Methods inherited from Base
#cache_key, #matches_change?, #narrow_frame_safe?, #to_h
Constructor Details
#initialize(source:, key:, value:, metadata: {}, partitioning: nil, absent_by_name: nil) ⇒ Identity
Returns a new instance of Identity.
275
276
277
278
279
280
281
282
283
284
285
286
287
|
# File 'lib/upkeep/dependencies.rb', line 275
def initialize(source:, key:, value:, metadata: {}, partitioning: nil, absent_by_name: nil)
metadata = metadata.dup
metadata[:partitioning_identity] = partitioning unless partitioning.nil?
if absent_by_name&.any?
metadata[:identity_absent_by_name] = absent_by_name.to_h.transform_keys(&:to_s)
end
super(
source: source,
key: { key: key, value: value },
metadata: metadata
)
end
|
Instance Method Details
#identity? ⇒ Boolean
289
290
291
|
# File 'lib/upkeep/dependencies.rb', line 289
def identity?
true
end
|
#identity_key ⇒ Object
293
294
295
|
# File 'lib/upkeep/dependencies.rb', line 293
def identity_key
{ source: source, key: key.fetch(:key), value: key.fetch(:value) }
end
|
#nil_identity? ⇒ Boolean
297
298
299
300
301
302
|
# File 'lib/upkeep/dependencies.rb', line 297
def nil_identity?
return true if key.fetch(:value).nil?
value_class = metadata[:value_class] || metadata["value_class"]
value_class.to_s == "NilClass"
end
|
#precision ⇒ Object
308
309
310
|
# File 'lib/upkeep/dependencies.rb', line 308
def precision
:identity
end
|
#visibility ⇒ Object
304
305
306
|
# File 'lib/upkeep/dependencies.rb', line 304
def visibility
:identity_bound
end
|