Class: Memcacheable::FetchAssociation

Inherits:
Fetcher
  • Object
show all
Defined in:
lib/memcacheable/fetch_association.rb

Direct Known Subclasses

FetchBelongsTo, FetchHasMany, FetchHasOne

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Fetcher

#debug, #fetch, #flush

Constructor Details

#initialize(object, association) ⇒ FetchAssociation

Returns a new instance of FetchAssociation.



5
6
7
8
# File 'lib/memcacheable/fetch_association.rb', line 5

def initialize(object, association)
  self.object = object
  self.association = association  
end

Instance Attribute Details

#associationObject

Returns the value of attribute association.



3
4
5
# File 'lib/memcacheable/fetch_association.rb', line 3

def association
  @association
end

#objectObject

Returns the value of attribute object.



3
4
5
# File 'lib/memcacheable/fetch_association.rb', line 3

def object
  @object
end

Instance Method Details

#cache_keyObject



10
11
12
# File 'lib/memcacheable/fetch_association.rb', line 10

def cache_key
  [object, association]
end

#class_nameObject



14
15
16
# File 'lib/memcacheable/fetch_association.rb', line 14

def class_name
  object.class.name.downcase
end

#descriptionObject



18
19
20
# File 'lib/memcacheable/fetch_association.rb', line 18

def description
  "#{association} for #{class_name} #{object.id}"
end