Skip to content

Instantly share code, notes, and snippets.

View tr_tree.rb
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)}
View challenge#2.rb
class Image
attr_accessor :data
def initialize (data)
@data = data
end
def image_blur
changes = []
@data.each_with_index do |row, row_index|
View cl1.rb
class Image
attr_accessor :data
def initialize (data)
@data = data
end
def output
@data.each do |sub|
sub.each do |cell|
print cell