Sha256: ad45cedbc6ad994a868ecdbef03cea8b1bd84d6b84b63c79fdb22ad8d116b00d
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
# encoding: utf-8 require 'securerandom' module Uploader autoload :Fileuploads, 'uploader/fileuploads' autoload :Asset, 'uploader/asset' autoload :AssetInstance, 'uploader/asset_instance' module Helpers autoload :FormTagHelper, 'uploader/helpers/form_tag_helper' autoload :FormBuilder, 'uploader/helpers/form_builder' autoload :FieldTag, 'uploader/helpers/field_tag' end def self.guid SecureRandom.base64(16).tr('+/=', 'xyz').slice(0, 20) end def self.root_path @root_path ||= Pathname.new( File.dirname(File.expand_path('../', __FILE__)) ) end def self.assets Dir[root_path.join('vendor/assets/**/uploader/**', '*.{js,css,png,gif}')].inject([]) do |list, path| folder = path.split('/assets/')[1].split('/')[0] list << Pathname.new(path).relative_path_from(root_path.join("vendor/assets/#{folder}")).to_s list end end def self.constantize(klass) return if klass.blank? klass.safe_constantize end def self.content_type(user_agent) return "application/json" if user_agent.blank? ie_version = user_agent.scan(/(MSIE\s|rv:)([\d\.]+)/).flatten.last if user_agent.include?("Android") || (ie_version && ie_version.to_f <= 9.0) || (user_agent =~ /Trident\/[0-9\.]+\;/i) "text/plain" else "application/json" end end end require 'uploader/engine'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails-uploader-0.2.7 | lib/uploader.rb |
rails-uploader-0.2.6 | lib/uploader.rb |