-
-
Save chadoh/5c2e3c83ef6aff4131e9 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
class Image | |
def initialize(arr) | |
@arr = arr | |
end | |
def print | |
@arr.each do |sub_array| | |
puts sub_array.join('') | |
end | |
end | |
end | |
image = Image.new([ | |
[0, 0, 0, 0], | |
[0, 1, 0, 0], | |
[0, 0, 0, 1], | |
[0, 0, 0, 0] | |
]) | |
image.print |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@umasenthil here's the more idiomatic-Ruby way to do this that we discussed in our mentor session 😄