Forum: Ruby on Rails assert2 0.3.2 and ActiveSupport 2.1.2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jeffrey L. Taylor (Guest)
on 2008-11-14 17:07
(Received via mailing list)
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
Jeffrey L. Taylor (Guest)
on 2008-11-16 01:37
(Received via mailing list)
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)

TIA,
  Jeffrey


Quoting Jeffrey L. Taylor <removed_email_address@domain.invalid>:
Jeffrey L. Taylor (Guest)
on 2008-11-16 02:01
(Received via mailing list)
Quoting Jeffrey L. Taylor <removed_email_address@domain.invalid>:
> Loading development environment (Rails 2.1.2)
>   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.

Jeffrey
This topic is locked and can not be replied to.