lib/rulebow/digest.rb
# Load digest from file system.
#
# Returns nothing.
Load digest from file system.
Returns nothing.
Load digest from file system . Returns nothing .
def read
      return unless File.exist?(filename)
      name = DEFAULT_NAME
      save = Hash.new{ |h,k| h[k.to_s] = {} }
      File.read(filename).lines.each do |line|
        if md = /^\[(\w+)\]$/.match(line)
          name = md[1]
        end
        if md = /^(\w+)\s+(.*?)$/.match(line)
          save[name][md[2]] = md[1]
        end
      end
      save.each do |name, digest|
        @saved[name] = digest
      end
    end
def read return unless File . exist? ( filename ) name = DEFAULT_NAME save = Hash . new { | h , k | h [ k . to_s ] = { } } File . read ( filename ) . lines . each do | line | if md = / ^ \[ ( \w +) \] $ / . match ( line ) name = md [ 1 ] end if md = / ^( \w +) \s +(.*?)$ / . match ( line ) save [ name ] [ md [ 2 ] ] = md [ 1 ] end end save . each do | name , digest | @saved [ name ] = digest end end
Load digest from file system.
Load digest from file system .