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.
310
311
312
313
314
315
316
317
318
319
320
321
322
|
# File 'lib/upkeep/dependencies.rb', line 310
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
324
325
326
|
# File 'lib/upkeep/dependencies.rb', line 324
def identity?
true
end
|
#identity_key ⇒ Object
328
329
330
|
# File 'lib/upkeep/dependencies.rb', line 328
def identity_key
{ source: source, key: key.fetch(:key), value: key.fetch(:value) }
end
|
#nil_identity? ⇒ Boolean
332
333
334
335
336
337
|
# File 'lib/upkeep/dependencies.rb', line 332
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
343
344
345
|
# File 'lib/upkeep/dependencies.rb', line 343
def precision
:identity
end
|
#visibility ⇒ Object
339
340
341
|
# File 'lib/upkeep/dependencies.rb', line 339
def visibility
:identity_bound
end
|