Here's my solution, it creates a buffer to draw into, once done it puts it on 
the screen:

----- circle.rb -----
class Circle
  def initialize(rad, asp)
    @rad, @asp = rad, asp       # radius, horizontal aspect ratio
    @height = rad*2+1           # hight/width of the pictures
    @width = (@height*asp).round
    @buf = Array.new(@height, ' ').map { |e| Array.new(@width, ' ') }
  end
  def draw
     (0..Math::PI*2).step(1/(@rad*@asp*2)) do |deg|
         @buf[((@height/2) + (Math::sin(deg)*@rad)).round]   \
             [((@width/2) + (Math::cos(deg)*@rad*@asp)).round] = '#'
     end
     @buf.map { |l| l.join + "\n"}.join
  end
end
puts Circle.new((ARGV[0] || 7).to_i, (ARGV[1] || 1).to_f).draw
----- end circle.rb -----


On Friday 13 June 2008 14:47:38 Matthew Moss wrote:
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
> The three rules of Ruby Quiz 2:
>
> 1.  Please do not post any solutions or spoiler discussion for this
> quiz until 48 hours have passed from the time on this message.
>
> 2.  Support Ruby Quiz 2 by submitting ideas as often as you can! (A
> permanent, new website is in the works for Ruby Quiz 2. Until then,
> please visit the temporary website at
>
>      <http://splatbang.com/rubyquiz/>.
> 3.  Enjoy!
>
> Suggestion:  A [QUIZ] in the subject of emails about the problem
> helps everyone on Ruby Talk follow the discussion.  Please reply to
> the original quiz message, if you can.
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
> ## Circle Drawing (#166)
>
> This week we're going to keep it simple... very simple.
>
> Given a radius, draw an ASCII circle.
>
> For example:
>
>     ruby circle.rb 7
>
> Should produce a circle of radius 7:
>
>          #####
>        ##     ##
>       #         #
>      #           #
>      #           #
>     #             #
>     #             #
>     #             #
>     #             #
>     #             #
>      #           #
>      #           #
>       #         #
>        ##     ##
>          #####
>
>
> Note that most fonts do not have a square aspect ratio, which is why the
> above output may look like an oval, despite my calculations for a circle.
> It is acceptable if your code produces similar output.
>
>
> However, _for extra credit_ you may support an additional argument that
> specifies the aspect ratio (height divided by width).
>
>     ruby circle.rb 7 1.4
>
> This should draw a circle of radius 7 with aspect ratio of 1.4. If done
> correctly, your output will actually look like a circle (assuming 1.4 is an
> accurate measure of the actual aspect ratio).