Module: Joint

Extended by:
ActiveSupport::Concern
Defined in:
lib/joint.rb,
lib/joint/io.rb,
lib/joint/version.rb,
lib/joint/class_methods.rb,
lib/joint/attachment_proxy.rb,
lib/joint/instance_methods.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: AttachmentProxy, IO

Constant Summary collapse

Version =
'0.6.2'

Class Method Summary collapse

Class Method Details

.name(file) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/joint.rb', line 14

def self.name(file)
  if file.respond_to?(:original_filename)
    file.original_filename
  else
    File.basename(file.path)
  end
end

.size(file) ⇒ Object



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

def self.size(file)
  if file.respond_to?(:size)
    file.size
  else
    File.size(file)
  end
end

.type(file) ⇒ Object



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

def self.type(file)
  return file.type if file.is_a?(Joint::IO)
  Wand.wave(file.path, :original_filename => Joint.name(file))
end