Module: BetterStorage::S3ServiceProxy

Defined in:
lib/better_storage/s3_service_proxy.rb

Overview

protect production files from deletion in development

Instance Method Summary collapse

Instance Method Details

#delete(key) ⇒ Object



8
9
10
11
# File 'lib/better_storage/s3_service_proxy.rb', line 8

def delete(key)
  return true if is_protected?(key)
  super
end

#delete_prefixed(prefix) ⇒ Object



13
14
15
16
# File 'lib/better_storage/s3_service_proxy.rb', line 13

def delete_prefixed(prefix)
  return true if is_protected?(prefix)
  super
end

#is_protected?(key) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/better_storage/s3_service_proxy.rb', line 4

def is_protected?(key)
  BetterStorage.protect_production_files && !key.start_with?("dev/")
end