Class: PTJ::Parser::HashPassOnlyColon

Inherits:
FileParser
  • Object
show all
Defined in:
lib/ptj/parser/fileparser/hashpassonlycolon.rb

Overview

FileParser class which allows you to parse a file line by line.

Instance Method Summary collapse

Instance Method Details

#parse_line(line) ⇒ Object

Expecting the following format: hash:pass hash:pass hash:pass

Parameters:

  • line

    Individual line from a text file

Returns:

  • Hash Password, Password Hash



16
17
18
19
20
21
22
# File 'lib/ptj/parser/fileparser/hashpassonlycolon.rb', line 16

def parse_line(line)
  if line =~ /^(\S+):(\S+)/
    pass = $~[2]
    hash = $~[1]
  end
  {:mypass => pass, :myhash => hash}
end