Sha256: 5111409fca4cfdedcca83ff635f163a412702dce19f211534ffc936c9489f3d7

Contents?: true

Size: 821 Bytes

Versions: 5

Compression:

Stored size: 821 Bytes

Contents

require 'set'
require 'mime/types'
require 'wand'

module Joint
  extend ActiveSupport::Concern

  included do
    class_attribute :attachment_names
    self.attachment_names = Set.new
    include attachment_accessor_module
  end

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

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

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

private
  def self.blank?(str)
    str.nil? || str !~ /\S/
  end
end

require 'joint/class_methods'
require 'joint/instance_methods'
require 'joint/attachment_proxy'
require 'joint/io'

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
joint-0.6.2 lib/joint.rb
jamieorc-joint-0.6.2 lib/joint.rb
joint-0.6.1 lib/joint.rb
jamieorc-joint-0.6.1 lib/joint.rb
joint-0.6.0 lib/joint.rb