class Rstreet::Uploadable

Attributes

hash[R]
name[R]
path[R]

Public Class Methods

new(name, path) click to toggle source
# File lib/uploadable.rb, line 7
def initialize(name, path)
  @name, @path = name, path
  @hash = gen_hash || ""
  @content_type = gen_content_type || "application/octet-stream"
end

Private Instance Methods

gen_content_type() click to toggle source
# File lib/uploadable.rb, line 19
def gen_content_type
  MIME::Types.type_for(@path).first.content_type
rescue
end
gen_hash() click to toggle source
# File lib/uploadable.rb, line 15
def gen_hash
  Digest::MD5.file(@path).hexdigest if File.file?(@path)
end