Class: DataMapper::SubjectSet::NameCache Private
- Inherits:
-
Object
- Object
- DataMapper::SubjectSet::NameCache
- Includes:
- OrderedSet::Cache::API
- Defined in:
- lib/dm-core/support/subject_set.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
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).
Instance Method Summary collapse
-
#key_for(entry) ⇒ #to_s?
private
Given an entry, return the key to be used in the cache.
-
#valid?(entry) ⇒ Boolean
private
Tests if the given entry qualifies to be added to the cache.
Methods included from OrderedSet::Cache::API
#[], #[]=, #clear, #delete, #include?, #initialize
Instance Method Details
#key_for(entry) ⇒ #to_s?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Given an entry, return the key to be used in the cache
76 77 78 |
# File 'lib/dm-core/support/subject_set.rb', line 76 def key_for(entry) valid?(entry) ? entry.name : nil end |
#valid?(entry) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Tests if the given entry qualifies to be added to the cache
63 64 65 |
# File 'lib/dm-core/support/subject_set.rb', line 63 def valid?(entry) entry.respond_to?(:name) end |