Sha256: ec41f9b0f24a6f9c4db32d5eb9d7fc3d63f511c9b267f476d368545c9ae03b9f

Contents?: true

Size: 1.11 KB

Versions: 32

Compression:

Stored size: 1.11 KB

Contents

module Cloudinary::Cache
  class BreakpointsCache
    attr_accessor :adapter

    def set(public_id, options, value)
      upload_type, resource_type, transformation, format = options_to_parameters(options)
      @adapter.set(public_id, upload_type, resource_type, transformation, format, value)

    end

    def fetch(public_id, options)
      upload_type, resource_type, transformation, format = options_to_parameters(options)
      @adapter.set(public_id, upload_type, resource_type, transformation, format, &Proc.new)

    end

    def get(public_id, options)
      upload_type, resource_type, transformation, format = options_to_parameters(options)
      @adapter.get(public_id, upload_type, resource_type, transformation, format)
    end

    def options_to_parameters(options)
      options = Cloudinary::Utils.symbolize_keys options
      transformation = Cloudinary::Utils.generate_transformation_string(options)
      upload_type = options[:type] || 'upload'
      resource_type = options[:resource_type] || 'image'
      format = options[:format] || ""
      [upload_type, resource_type, transformation, format]
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
cloudinary-2.2.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-2.1.2 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-2.0.2 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-2.0.1 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-2.0.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.29.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.28.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.27.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.26.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.25.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.24.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.23.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.22.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.21.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.20.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.19.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.18.1 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.18.0 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.17.1 lib/cloudinary/cache/breakpoints_cache.rb
cloudinary-1.17.0 lib/cloudinary/cache/breakpoints_cache.rb