KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
It's been a very long time since I've used ruby for things like this but, I forget how to open a file, look for a string, and print what ruby finds. Here is what I have: #!/usr/bin/env ruby f = File.new("file.txt") text = f.read if text =~ /string/ then puts test end I want to determine what the "document root" (routes) is in config/routes.rb If I print the string, it prints the file. I feel dumb that I don't remember what this is, but I need to know. Hopefully, I can make it print this: # Route is: blah blah blah blah
Tags (comma-separated)
Save Edits
Cancel