T. Onoma wrote:

...

>    class OpenURI::ProgessProc     
>      def initialize
>        @on_empty = false
>        @parameters = [ :pos ]
>      end
>      def progress_proc=(x)
>        @progress_proc= x
>      end
>      def on_empty=(x)
>        @on_empty = (x == true)
>      end
>      def pass_parameters=(*y)
>        @pass_parameters = y
>      end
>    end
>  
> so that
>  
>    progress = OpenURI::Progess.new
>    progress.progress_proc = proc { |b, t| ... }
>    progress.parameters = [ :pos, :total ]
>    progress.on_empty = true
>    open(url,progress)


Maybe this is kind of silly but a class name ``OpenURI::ProgessProc''
suggests to me that the latter is a sub class of Proc - also I'd
would tend to use default values. So I might rewrite this as ...



class OpenURI::ProgessProc  < Proc
   def initialize(on_empty, parameters)
	super()
   	@on_empty = on_empty ? true : false
      @parameters = parameters
   end

   def on_empty=(x) # mimic for example Thread.critical(=) ..  
     @on_empty = x ? true : false
   end  
   ...
end

def OpenURI::ProgessProc(on_empty = false, parameters = [ :pos ])
   OpenURI::ProgessProc.new(on_empty, parameters)
end


With this definition you could create ProgressProc's 

  OpenURI::ProgessProc {|s| ... }
  OpenURI::ProgessProc(true) {|s| ... }
 


/Christoph