Created
May 3, 2014 04:24
-
-
Save shinokada/11491600 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $: << File.join(File.dirname(__FILE__), '..', 'lib') | |
| require 'pry' if ENV['APP_ENV'] == 'debug' # add `binding.pry` wherever you need to debug | |
| require 'fish' | |
| def read_file_to_arr(file_name) | |
| # ['17, 10, 16 3, 7'] | |
| # ["4", "bar", "abracadabra", "bear", "bar", "baraxbara"] | |
| File.readlines(file_name).map(&:chomp) | |
| end | |
| def read_file_to_str(file_name) | |
| # '17, 10, 16, 3, 7' | |
| # "4 bar abracadabra bear bar baraxbara" | |
| File.readlines(file_name).map(&:chomp).join(' ') | |
| end | |
| def read_num_to_arr(file_name) | |
| # [17, 10, 16, 3, 7] | |
| File.readlines(file_name).map(&:chomp).map(&:to_i) | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment