Created
December 10, 2014 02:04
-
-
Save bradpauly/a7b4557bb51914460dd2 to your computer and use it in GitHub Desktop.
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
class Matrix | |
def initialize(numbers) | |
@numbers = numbers | |
end | |
def rows | |
@rows ||= @numbers.split("\n").map{ |row| row.split.map(&:to_i) } | |
end | |
def columns | |
rows.transpose | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment