Sha256: dcea5a6a4dcd4b545a80bfc1c7340147b7ff36e7cecd06276ec7b58c580a499d

Contents?: true

Size: 1007 Bytes

Versions: 5

Compression:

Stored size: 1007 Bytes

Contents

# encoding: utf-8
require 'fileutils'

module Sunrise
  module Utils
    autoload :Header, 'sunrise/utils/header'
    autoload :Mysql, 'sunrise/utils/mysql'
    autoload :Settingslogic, 'sunrise/utils/settingslogic'
    autoload :Transliteration, 'sunrise/utils/transliteration'
    autoload :AccessibleAttributes, 'sunrise/utils/accessible_attributes'
    autoload :I18nBackend, 'sunrise/utils/i18n_backend'
    
    IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/jpg', 'image/pjpeg', 'image/tiff', 'image/x-png']
    
    def self.parameterize_filename(filename)
      extension = File.extname(filename)
      basename = filename.gsub(/#{extension}$/, "")
        
      [basename.parameterize('_'), extension].join.downcase
    end
    
    def self.clear_cache
      cache_store = Rails.application.config.action_controller.cache_store
	    cache_store.clear if cache_store
	  
	    FileUtils.rm_r(Dir.glob(Rails.root.join('public', 'cache', '*').to_s), :force => true)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sunrise-core-0.2.2 lib/sunrise/utils.rb
sunrise-core-0.2.1 lib/sunrise/utils.rb
sunrise-core-0.2.0 lib/sunrise/utils.rb
sunrise-core-0.1.5 lib/sunrise/utils.rb
sunrise-core-0.1.4 lib/sunrise/utils.rb