Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = File.open("foo.txt")
- username = ""
- password = ""
- File.foreach("foo.txt") do |l|
- if l =~ /^\s*username\s*=\s*(\w+)\s*/
- username = $1
- elsif l =~ /^\s*password\s*=\s*(\w+)\s*/
- password = $1
- end
- end
- puts username
- puts password
- ~
Add Comment
Please, Sign In to add comment