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.
243
244
245
246
247
248
249
250
251
252
253
254
255
|
# File 'lib/upkeep/dependencies.rb', line 243
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
257
258
259
|
# File 'lib/upkeep/dependencies.rb', line 257
def identity?
true
end
|
#identity_key ⇒ Object
261
262
263
|
# File 'lib/upkeep/dependencies.rb', line 261
def identity_key
{ source: source, key: key.fetch(:key), value: key.fetch(:value) }
end
|
#nil_identity? ⇒ Boolean
265
266
267
268
269
270
|
# File 'lib/upkeep/dependencies.rb', line 265
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
276
277
278
|
# File 'lib/upkeep/dependencies.rb', line 276
def precision
:identity
end
|
#visibility ⇒ Object
272
273
274
|
# File 'lib/upkeep/dependencies.rb', line 272
def visibility
:identity_bound
end
|