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 Tree | |
attr_accessor :payload, :children | |
def initialize(payload, children = []) | |
@payload = payload | |
@children = children | |
end | |
def traverse(&block) | |
yield self | |
@children.each {|child| child.traverse(&block)} |
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 | |
attr_accessor :data | |
def initialize (data) | |
@data = data | |
end | |
def image_blur | |
changes = [] | |
@data.each_with_index do |row, row_index| |
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 | |
attr_accessor :data | |
def initialize (data) | |
@data = data | |
end | |
def output | |
@data.each do |sub| | |
sub.each do |cell| | |
print cell |