Skip to content

Instantly share code, notes, and snippets.

@twosevenzero
Created October 20, 2013 13:31

Revisions

  1. twosevenzero created this gist Oct 20, 2013.
    13 changes: 13 additions & 0 deletions ugh.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #
    # 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