As project 1 unfolded both my team-mate and I had our minds racing with ideas.  We took on a pretty big task and we still didn’t fully understand in what direction we were going.

CLI is fun and a great place to start but I wanted some visuals I wanted to see all the information that I was scraping.  I told my partner Damian “What if we have it open up like chrome or something”   To which he responded along the lines of that’s cool and all but good luck doing that but if you do let me know.

Almost if by magic,  as if the gods of Ruby docs had heard my cry for help. I stumbled upon magic characters that would make all my troubles disappear.

Using %x or backticks

Under the kernel class in Ruby are execute commands that you can use to have ruby interact with your terminal. There are many functions and uses but I will cover one that I found particularly useful and that might come in handy for someone later on.

Screen Shot 2015-08-19 at 9.18.19 AM

Using backticks (`) or (%x) will allow ruby to execute the command you have placed within the backticks through the terminal.  This an example of our project code in which we ask one of our variables to open up in terminal.

Screen Shot 2015-08-19 at 9.24.22 AM

This is the same as if you were to type in the following ruby command in irb:


In fact any command that can be executed within the terminal. From creating directories, to creating files to moving files can all be executed as long as they are within %x` ` the backticks.

Two Very Helpful Links

Ruby-Doc`cmd` → string

Executing commands in ruby