Expanding pixels in an image
I assume you are trying to do something like:

def blur(n) 
  blurred = Image.new(self).arr.transform
  (n-1).times do 
    blurred = blurred.transform
  end
  blurred
end


And getting an error like: 

`block in blur': undefined method `transform' for #&lt;Array:0x00000002d51ba8&gt;


The reason is that transform is a instance method of Image, which is why you need to convert back into an image before calling it.

There are a couple of way this can be handled.  I've chosen to make transform a static method that only works on arrays.  The instance methods transform and blur call the static method as needed

class Image
  attr_accessor :arr

  def initialize(arr)
    @arr = arr
  end

  def transform
    result = Image.arr_transform(@arr)
    Image.new(result)
  end

  def self.arr_transform(array) 
    cloned = array.map(&amp;:clone)

    #scan original array for 1; map crosses into clone if found
    array.each.with_index do |row, row_index|
      row.each.with_index do |cell, col|
        if cell == 1
          cloned[row_index][col+1] = 1 unless col+1 &gt;= row.length #copy right
          cloned[row_index+1][col] = 1 unless row_index+1 &gt;= cloned.length # copy down
          cloned[row_index][col-1] = 1 unless col.zero? # copy left
          cloned[row_index-1][col] = 1 unless row_index.zero? #copy up
        end
      end
    end
    cloned
  end

  def blur(n)
    blurred = @arr
    (n).times do 
      blurred = Image.arr_transform(blurred)
    end
    Image.new(blurred)
  end

end


Testing:

image = Image.new([[0,0,0,0,0,0,0,0,0],
                   [0,0,0,0,0,0,0,0,0],
                   [0,0,0,0,0,0,0,0,0],
                   [0,0,0,0,0,0,0,0,0],
                   [0,0,0,0,1,0,0,0,0],
                   [0,0,0,0,0,0,0,0,0],
                   [0,0,0,0,0,0,0,0,0],
                   [0,0,0,0,0,0,0,0,0],
                   [0,0,0,0,0,0,0,0,0],
                   [0,0,0,0,0,0,0,0,0],
                   [0,0,0,0,0,0,0,0,0],
                   [0,0,0,0,0,0,0,0,0]])

require 'pp'
pp image.blur(3)


Returns:

#&lt;Image:0x00000002e9fb40
 @arr=
  [[0, 0, 0, 0, 0, 0, 0, 0, 0],
   [0, 0, 0, 0, 1, 0, 0, 0, 0],
   [0, 0, 0, 1, 1, 1, 0, 0, 0],
   [0, 0, 1, 1, 1, 1, 1, 0, 0],
   [0, 1, 1, 1, 1, 1, 1, 1, 0],
   [0, 0, 1, 1, 1, 1, 1, 0, 0],
   [0, 0, 0, 1, 1, 1, 0, 0, 0],
   [0, 0, 0, 0, 1, 0, 0, 0, 0],
   [0, 0, 0, 0, 0, 0, 0, 0, 0],
   [0, 0, 0, 0, 0, 0, 0, 0, 0],
   [0, 0, 0, 0, 0, 0, 0, 0, 0],
   [0, 0, 0, 0, 0, 0, 0, 0, 0]]&gt;