class DataMapper::SubjectSet::NameCache
An {OrderedSet::Cache::API} implementation that establishes set semantics based on the name of its entries. The cache uses the entries' names as cache key and refuses to add entries that don't respond_to?(:name).
@api private
Public Instance Methods
key_for(entry)
click to toggle source
Given an entry, return the key to be used in the cache
@param [#name] entry
the entry to get the key for
@return [#to_s, nil]
the entry's name or nil if the entry isn't #valid?
@api private
# File lib/dm-core/support/subject_set.rb, line 76 def key_for(entry) valid?(entry) ? entry.name : nil end
valid?(entry)
click to toggle source
Tests if the given entry qualifies to be added to the cache
@param [#name] entry
the entry to be checked
@return [Boolean]
true if the entry respond_to?(:name)
@api private
# File lib/dm-core/support/subject_set.rb, line 63 def valid?(entry) entry.respond_to?(:name) end