Module: Uploader

Defined in:
lib/uploader.rb,
lib/uploader/asset.rb,
lib/uploader/engine.rb,
lib/uploader/version.rb,
lib/uploader/fileuploads.rb,
lib/uploader/helpers/field_tag.rb,
lib/uploader/helpers/form_builder.rb,
lib/uploader/helpers/form_tag_helper.rb,
app/controllers/uploader/attachments_controller.rb

Defined Under Namespace

Modules: Asset, Fileuploads, Helpers Classes: AttachmentsController, Engine

Constant Summary collapse

VERSION =
"0.12.0".freeze

Class Method Summary collapse

Class Method Details

.assetsObject



22
23
24
25
26
27
28
# File 'lib/uploader.rb', line 22

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

.constantize(klass) ⇒ Object



30
31
32
33
# File 'lib/uploader.rb', line 30

def self.constantize(klass)
  return if klass.blank?
  klass.safe_constantize
end

.guidObject



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

def self.guid
  SecureRandom.base64(16).tr('+/=', 'xyz').slice(0, 20)
end

.root_pathObject



18
19
20
# File 'lib/uploader.rb', line 18

def self.root_path
  @root_path ||= Pathname.new( File.dirname(File.expand_path('../', __FILE__)) )
end