Module: ThreeD::ModelFragments::InstanceMethods

Defined in:
lib/three_d/model_fragments.rb

Instance Method Summary collapse

Instance Method Details

#cache(data, scope_data = nil, &block) ⇒ Object



52
53
54
# File 'lib/three_d/model_fragments.rb', line 52

def cache(data, scope_data=nil, &block)
  # TODO: Implement Cache function directly from model instance
end

#cache_name(data, scope_data = nil) ⇒ Object



57
58
59
60
61
62
# File 'lib/three_d/model_fragments.rb', line 57

def cache_name(data, scope_data=nil)  
  data = data.to_s
  x = "#{self.class.name.parameterize}_#{self.id}_cache_#{data}"
  x << "_#{scope_data.to_s}" if scope_data
  return x
end

#clear_view_cache(data = "") ⇒ Object



64
65
66
# File 'lib/three_d/model_fragments.rb', line 64

def clear_view_cache(data="")
  %x(rm #{self.full_cache_path(data)})
end

#full_cache_path(data = "") ⇒ Object



68
69
70
# File 'lib/three_d/model_fragments.rb', line 68

def full_cache_path(data="")
  "#{self.class.caching_path}/views/#{self.class.name.parameterize}_#{self.id}_#{data}*"
end