I've found a conflict between assert2 and ActiveSupport. Both define the
method in_groups_of() with different signatures and semantics. It shows up in
Ultrasphinx when I run my tests. I've reproduced it in the console, see
below. Any suggests on how to force the desired in_groups_of() method?
TIA,
Jeffrey
script/console
Loading development environment (Rails 2.1.2)
a = [1, 2, 3, 4]
=> [1, 2, 3, 4]
a.in_groups_of(2)
=> [[1, 2], [3, 4]]
require 'assert2'
=> ["Assert_2_0"]
a.in_groups_of(2)
LocalJumpError: no block given
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `each_slice'
from /usr/lib/ruby/gems/1.8/gems/assert2-0.3.1/lib/ruby_reflector.rb:829:in `each'
from /usr/lib/ruby/gems/1.8/gems/assert2-0.3.1/lib/ruby_reflector.rb:829:in `each_slice'
from /usr/lib/ruby/gems/1.8/gems/assert2-0.3.1/lib/ruby_reflector.rb:829:in `in_groups_of'
from (irb):4
I find it hard to beleive that I am the only one using both UltraSphinx and
assert{2.0}. To make the question more general, how do I in Ruby disambiguate
method calls? I.e., given two methods with identical names, say meth, in different
namespace, e.g., NS1 and NS2 how do a force a call to one of them? Using the
example below, I'd like to call
a.NS1::in_groups_of(2) or maybe a.NS1.in_groups_of(2)
I've found a conflict between assert2 and ActiveSupport. Both define the
method in_groups_of() with different signatures and semantics. It shows up in
Ultrasphinx when I run my tests. I've reproduced it in the console, see
below. Any suggests on how to force the desired in_groups_of() method?
TIA,
Jeffrey
> script/console
Loading development environment (Rails 2.1.2)
>> a = [1, 2, 3, 4]
=> [1, 2, 3, 4]
>> a.in_groups_of(2)
=> [[1, 2], [3, 4]]
>> require 'assert2'
=> ["Assert_2_0"]
>> a.in_groups_of(2)
LocalJumpError: no block given
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `each_slice'
from /usr/lib/ruby/gems/1.8/gems/assert2-0.3.1/lib/ruby_reflector.rb:829:in `each'
from /usr/lib/ruby/gems/1.8/gems/assert2-0.3.1/lib/ruby_reflector.rb:829:in `each_slice'
from /usr/lib/ruby/gems/1.8/gems/assert2-0.3.1/lib/ruby_reflector.rb:829:in `in_groups_of'
from (irb):4
>> quit
My solution is to delete the in_groups_of method in the assert{2.0}. It
appears to be just a special case of the code in ActiveSupport.