Class: EntityCache::Subject

Inherits:
Object
  • Object
show all
Includes:
Schema::DataStructure
Defined in:
lib/entity_cache/subject.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.hash_key(entity_class, specifier = nil) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/entity_cache/subject.rb', line 17

def self.hash_key(entity_class, specifier=nil)
  if specifier.nil?
    "#{entity_class}"
  else
    "#{entity_class}#{hash_key_separator}#{specifier}"
  end
end

.hash_key_separatorObject



25
26
27
# File 'lib/entity_cache/subject.rb', line 25

def self.hash_key_separator
  '/'
end

Instance Method Details

#hashObject



13
14
15
# File 'lib/entity_cache/subject.rb', line 13

def hash
  hash_key.hash
end

#hash_keyObject



8
9
10
# File 'lib/entity_cache/subject.rb', line 8

def hash_key
  self.class.hash_key(entity_class, specifier)
end

#to_sObject



11
12
13
# File 'lib/entity_cache/subject.rb', line 11

def hash_key
  self.class.hash_key(entity_class, specifier)
end