From: Nasir Khan Date: 2007-06-10T05:14:02+09:00 Subject: Re: bug in facets 1.8.54 Ah! pqueue.rb was changed to be backward incompatible from facets 1.8.51 -> 1.8.54 # 1.8.51 def initialize(compareProc=lambda{|x,y| x>y}) # By default, retrieves maximal elements first. @qarray=[nil]; @size=0; @gt=compareProc; make_legal end # 1.8.54 def initialize(elements=nil, &block) # :yields: a, b @qarray = [nil] @size = 0 @gt = block || lambda {|a,b| a > b} replace(elements) if elements end Is there a way to load 1.8.51 version of one file (in this case pqueue.rb) while use rest of the facets gem 1.8.54? The other option is to monkey patch :-( Any other option? - nasir On Jun 9, 1:01 pm, "Nasir Khan" wrote: > There seems to be a bug in facets PQueue v1.8.54, at least the behavior is > inconsistent. Here is the output on machine-1 which is running - > > --------------------------------------------------------- > ruby 1.8.5 (2006-08-25) [i386-mswin32] > facets (1.8.51, 1.8.8) > > irb(main):001:0> require 'facets/more/pqueue' > => true > irb(main):002:0> pqueue = PQueue.new(lambda{|x,y| x => #, @size=0, @qarray=[n > irb(main):003:0> > irb(main):004:0* pqueue.top > => nil > --------------------------------------------- > This is the expected behavior > > While on another machine with - > > ----------------------------------------- > ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] > facets (1.8.54) > > irb(main):001:0> require 'facets/more/pqueue' > => true > irb(main):002:0> @pqueue = PQueue.new(lambda{|x,y| x c:/ruby/lib/ruby/gems/1.8/gems/facets-1.8.54/lib/facets/more/pqueue.rb:236: > warn > ing: default `to_a' will be obsolete > => > > irb(main):003:0> @pqueue.top > => # > --------------------------------------------- > > Strangely the lambda supplied as the comparator is inserted in the queue. > Both Ruby and Facets version is different. > > TIA > - nasir