Module: Refile::Backgrounder::Attacher

Defined in:
lib/refile/backgrounder/attacher.rb

Instance Method Summary collapse

Instance Method Details

#background?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/refile/backgrounder/attacher.rb', line 5

def background?
  record.respond_to? "#{name}_cache_id"
end

#cache_idObject



9
10
11
# File 'lib/refile/backgrounder/attacher.rb', line 9

def cache_id
  super || (background? and record.send("#{name}_cache_id"))
end

#save_cache_idObject



22
23
24
# File 'lib/refile/backgrounder/attacher.rb', line 22

def save_cache_id
  record.send "#{name}_cache_id=", cache_id if background?
end

#setObject



13
14
15
16
# File 'lib/refile/backgrounder/attacher.rb', line 13

def set(*)
  super
  save_cache_id
end

#store!Object



18
19
20
# File 'lib/refile/backgrounder/attacher.rb', line 18

def store!
  super unless background?
end