Class: FileHash

Inherits:
Object
  • Object
show all
Defined in:
lib/file_sentry/file_hash.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ FileHash

Returns a new instance of FileHash.



5
6
7
# File 'lib/file_sentry/file_hash.rb', line 5

def initialize(attributes)
  attributes.each {|attribute, value| self.send("#{attribute}=", value)}
end

Instance Attribute Details

#op_fileObject

Returns the value of attribute op_file.



3
4
5
# File 'lib/file_sentry/file_hash.rb', line 3

def op_file
  @op_file
end

Instance Method Details

#hash_file(encryption) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/file_sentry/file_hash.rb', line 9

def hash_file(encryption)
  begin
    self.send("digest_#{encryption.downcase}")
  rescue
    raise "No encryption found for: #{encryption}"
  end
end