Module: Scales::Worker::Cache

Defined in:
lib/scales-worker/cache.rb,
lib/scales-worker/cache/xml.rb,
lib/scales-worker/cache/html.rb,
lib/scales-worker/cache/json.rb,
lib/scales-worker/cache/push.rb,
lib/scales-worker/cache/update.rb,
lib/scales-worker/cache/destroy.rb

Defined Under Namespace

Modules: Destroy, HTML, JSON, Push, Update, XML

Class Method Summary collapse

Class Method Details

.class_for(params_or_format) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/scales-worker/cache.rb', line 13

def class_for params_or_format
  params = params_or_format.is_a?(Symbol) ? { params_or_format => nil } : params_or_format
  
  return HTML if params.keys.include?(:html)
  return JSON if params.keys.include?(:json)
  return XML  if params.keys.include?(:xml)
end

.resource_or_partial?(path) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/scales-worker/cache.rb', line 21

def resource_or_partial?(path)
  (path =~ /^\//) ? "resource" : "partial"
end