Ruby Reading file contents and pushing selected criteria into an array within an array -


I want to create a simple Ruby program that can read the contents of an html page and output two pieces of information Could Array

For example, this webpage is:

I want to be my output:

  output = [[Mid-Cambridge, $ 642,126] [East Cambridge, $ 611,436] [neighborhood nine, 1,068,284 dollars] [West Cambridge, $ 1,577,444]]  

I was thinking of doing this:

And from there, pass each neighbor together in the HTML file in the array, rinse together and then repeat. But I think this may not be the most effective way, and I'm not sure how to get it.

I have also heard that the 'search_in_file' function may be useful but it may not be necessary.

You want to take a look, which is a great gem when you want to work with webpages. Need and want to remove the information from.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -