Module: CarrierWave::Cloudflare

Extended by:
ActiveSupport::Concern
Defined in:
lib/carrierwave/cloudflare.rb,
lib/carrierwave/cloudflare/url.rb,
lib/carrierwave/cloudflare/railtie.rb,
lib/carrierwave/cloudflare/version.rb,
lib/carrierwave/cloudflare/url/query_string.rb,
lib/carrierwave/cloudflare/action_view/responsive_images_helper.rb

Defined Under Namespace

Modules: ActionView, ClassMethods, URL Classes: Railtie

Constant Summary collapse

VERSION =
"0.5.0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cloudflare_transform(value = nil) ⇒ Object



34
35
36
37
38
# File 'lib/carrierwave/cloudflare.rb', line 34

def self.cloudflare_transform(value = nil)
  return @cloudflare_transform if value.nil?

  @cloudflare_transform = value
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



30
31
32
# File 'lib/carrierwave/cloudflare.rb', line 30

def self.configure
  yield self
end

Instance Method Details

#cache!(*args) ⇒ Object



46
47
48
49
50
# File 'lib/carrierwave/cloudflare.rb', line 46

def cache!(*args)
  return if virtual_version?

  super(*args)
end

#resize(**options) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/carrierwave/cloudflare.rb', line 72

def resize(**options)
  # build temporary uploader
  uploader = self.class.dup
  self.class.const_set("Uploader#{uploader.object_id}".tr("-", "_"), uploader)
  uploader.version_options = { cdn_transform: options }

  # init the instance uploader and set parent_version
  obj = uploader.new(self)
  obj.parent_version = self
  obj
end

#retrieve_from_cache!(*args) ⇒ Object



52
53
54
55
56
# File 'lib/carrierwave/cloudflare.rb', line 52

def retrieve_from_cache!(*args)
  return if virtual_version?

  super(*args)
end

#retrieve_from_store!(*args) ⇒ Object



58
59
60
61
62
# File 'lib/carrierwave/cloudflare.rb', line 58

def retrieve_from_store!(*args)
  return if virtual_version?

  super(*args)
end

#store!(*args) ⇒ Object



40
41
42
43
44
# File 'lib/carrierwave/cloudflare.rb', line 40

def store!(*args)
  return if virtual_version?

  super(*args)
end

#url(*args) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/carrierwave/cloudflare.rb', line 64

def url(*args)
  if virtual_version?
    cdn_url
  else
    super(*args)
  end
end