List Recv wrote:
> Often, I find myself doing:
> 
> class RemoteCommand
>   def submit
>     sendto(URL, ...)
>   end
> end
> 
> class GetStockPriceCommand
>   URL = 'http://...'
> end
> 
> Which won't work.
> I'm forced to do:
> 
> sendto(self.class::URL, ...)
> 
> which just seems akward.  Same for using @@class_variables.
> 
> Why?  More importantly, is there a better workaround?

I assume you meant:    class GetStockPriceCommand < RemoteCommand

If so then the following will work:


  class RemoteCommand
    def submit
      sendto(url, ...)
    end
    def url
      self.class::URL
    end
  end

  class GetStockPriceCommand < RemoteCommand
    URL = 'http://...'
  end

--
-- Jim Weirich

-- 
Posted via http://www.ruby-forum.com/.