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



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

def delete(key)
  return false if should_protect?(key)
  super
end

#delete_prefixed(prefix) ⇒ Object



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

def delete_prefixed(prefix)
  return false if should_protect?(prefix)
  super
end

#should_protect?(key) ⇒ Boolean

Returns:

  • (Boolean)


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

def should_protect?(key)
  BetterStorage.protect_production_files && BetterStorage.protected_key?(key)
end