Sean O'Halpin
5/29/2008 8:46:00 PM
On Thu, May 29, 2008 at 9:42 AM, Abir B. <abboura84@yahoo.fr> wrote:
> Hello,
> I want to customize a method of a gem wuthout changing the source code
> of this gem .
> Is that possible?
Sure is:
require 'rubygems'
require 'pdf/writer'
w = PDF::Writer.new
w.text_width("Hello World") # => 51.67
class PDF::Writer
def text_width(s)
42.0
end
end
w.text_width("Hello World") # => 42.0
Regards,
Sean