Class: File

Inherits:
Object show all
Defined in:
lib/md5sum.rb,
lib/sym_tbl_gsub.rb

Overview

module Md5sum

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.md5sum(filename) ⇒ Object



16
17
18
19
20
# File 'lib/md5sum.rb', line 16

def self.md5sum(filename)
  md5 = Digest::MD5.new
  IO.foreach(filename) { |l| md5 << l }
  md5
end

Instance Method Details

#md5sumObject



22
23
24
25
26
# File 'lib/md5sum.rb', line 22

def md5sum
  md5 = Digest::MD5.new
  each { |l| md5 << l }
  md5
end

#symtbl_gsub(symtbl) ⇒ Object



277
278
279
280
# File 'lib/sym_tbl_gsub.rb', line 277

def symtbl_gsub ( symtbl )
  contents = read
  contents.symtbl_gsub! symtbl
end

#symtbl_gsub!(symtbl) ⇒ Object



267
268
269
270
271
272
273
274
275
# File 'lib/sym_tbl_gsub.rb', line 267

def symtbl_gsub! ( symtbl )
  contents = read
  result = contents.symtbl_gsub! symtbl
  if result
    truncate 0
    write contents
  end
  result
end