class Vera::Media
Attributes
path[R]
size[R]
Public Class Methods
new(path)
click to toggle source
# File lib/vera/media.rb, line 9 def initialize(path) @path = path size = File.size(@path) end
Public Instance Methods
filename()
click to toggle source
# File lib/vera/media.rb, line 14 def filename File.basename(@path) end
partial_hash()
click to toggle source
# File lib/vera/media.rb, line 18 def partial_hash chunk_size = 1024 * 5 chunk = File.read(@path, chunk_size) Digest::SHA1.hexdigest(chunk) end
real_hash()
click to toggle source
# File lib/vera/media.rb, line 24 def real_hash chunk = File.read(@path) Digest::SHA1.hexdigest(chunk) end