Sha256: c78dd1b6d634e4a38e0ea5cb59daafad76b1806f79560d659f4eca16684b2438

Contents?: true

Size: 871 Bytes

Versions: 3

Compression:

Stored size: 871 Bytes

Contents

module Scales
  module Worker
    module Cache
      autoload :HTML,     "scales-worker/cache/html"
      autoload :JSON,     "scales-worker/cache/json"
      autoload :XML,      "scales-worker/cache/xml"
      autoload :Push,     "scales-worker/cache/push"
      autoload :Destroy,  "scales-worker/cache/destroy"
      autoload :Update,   "scales-worker/cache/update"
      
      class << self
        
        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
        
        def resource_or_partial?(path)
          (path =~ /^\//) ? "resource" : "partial"
        end
        
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scales-worker-0.0.4 lib/scales-worker/cache.rb
scales-worker-0.0.1.beta.2 lib/scales-worker/cache.rb
scales-worker-0.0.1.beta.1 lib/scales-worker/cache.rb