I have published the Ruby gems string_in_file and array_in_file. Think
them as the ultimate global variables.
string_in_file is used for storing a string in a file. In addition to
writing a string value to a file and reading a string value from a file,
you can also:
- Check to see if a particular string value is present in a file.
- Replace every instance of a given string in a file with another
array_in_file is used for storing an array of strings in a file, with
string separated by a newline character.
I’m using string_in_file and array_in_file in my bsf_scrape and
gems, and I’m integrating them into my Bargain Stock Funds
(http://www.bargainstockfunds.com) and Doppler Value Investing
(http://www.dopplervalueinvesting.com) web sites as well. These gems
very simple, but they help me write cleaner code, as I don’t have to
rewriting the functions for every Ruby gem or Rails app.