class Phash::FileHash

Attributes

path[R]

Public Class Methods

for_paths(paths, *args) click to toggle source

Init multiple image instances

# File lib/phash.rb, line 35
def self.for_paths(paths, *args)
  paths.map do |path|
    new(path, *args)
  end
end
hash_type() click to toggle source
# File lib/phash.rb, line 56
def self.hash_type
  @hash_type ||= self.name.split('::').last.downcase
end
new(path) click to toggle source

File path

# File lib/phash.rb, line 30
def initialize(path)
  @path = path
end

Public Instance Methods

%(other, *args)
Alias for: similarity
compute_phash() click to toggle source
# File lib/phash.rb, line 46
def compute_phash
  Phash.send("#{self.class.hash_type}_hash", @path)
end
phash() click to toggle source

Cached hash of text

# File lib/phash.rb, line 42
def phash
  @phash ||= compute_phash
end
similarity(other, *args) click to toggle source

Similarity with other phash

# File lib/phash.rb, line 51
def similarity(other, *args)
  phash.similarity(other.phash, *args)
end
Also aliased as: %