Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Image
- attr_accessor :data
- def initialize(data)
- @data = data
- end
- def blur
- self.data.each_with_index do |row, y|
- row.each_with_index do |pixel, x|
- if pixel == 1
- # Code can go here
- if true # or you could add another conditional
- puts "Pixel at [#{x}, #{y}]"
- end
- if false
- puts "NEVER EXECUTED"
- end
- end
- end
- end
- end
- end
- image = Image.new([
- [0,0,1,0],
- [0,1,0,0]
- ])
- image.blur
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement