Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. class Image
  2. attr_accessor :data
  3. def initialize(data)
  4. @data = data
  5. end
  6.  
  7. def blur
  8. self.data.each_with_index do |row, y|
  9. row.each_with_index do |pixel, x|
  10. if pixel == 1
  11. # Code can go here
  12. if true # or you could add another conditional
  13. puts "Pixel at [#{x}, #{y}]"
  14. end
  15.  
  16. if false
  17. puts "NEVER EXECUTED"
  18. end
  19. end
  20. end
  21. end
  22.  
  23. end
  24.  
  25. end
  26.  
  27.  
  28. image = Image.new([
  29. [0,0,1,0],
  30. [0,1,0,0]
  31. ])
  32.  
  33. image.blur
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement