Created
October 20, 2013 13:31
-
-
Save twosevenzero/7069684 to your computer and use it in GitHub Desktop.
How can I fix this seemingly bad pattern.
This file contains 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
# | |
# I hate having to define a new array, run the each loop and then explicitly return the array. | |
# | |
# How can I fix this. | |
# | |
def rows | |
rows_as_array = Array.new | |
@puzzle.each_line do |line| | |
rows_as_array.push line.gsub(/[\s\|\-\+]/,"").split(//) unless line.start_with?("-") | |
end | |
rows_as_array | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment