From: Intransition on
Ruby 1.9.2-head

p require_relative('foo')

module Kernel
p method_defined?(:require_relative)
end

produces

true
false

Huh?

From: Robert Dober on
On Fri, Jun 4, 2010 at 1:27 PM, Intransition <transfire(a)gmail.com> wrote:
> Ruby 1.9.2-head
>
>  p require_relative('foo')
>
>  module Kernel
>    p method_defined?(:require_relative)
>  end
>
> produces
>
>  true
>  false
>
> Huh?
>
>



--
The best way to predict the future is to invent it.
-- Alan Kay

From: Robert Dober on
Hmm maybe I was not very clear in my last post ;)

require_relative is defined in Object

ruby -ve 'p method( :require_relative)'
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
#<Method: Object#require_relative>

ruby -ve 'p Object.method( :require_relative )'
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
#<Method: Class(Object)#require_relative>

However

ruby -ve 'p Object.methods.grep( /require/ )'
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
[]
^^^^ ????

Maybe a tiny bug here?

Cheers
R.

--
The best way to predict the future is to invent it.
-- Alan Kay

From: Rob Biedenharn on

On Jun 4, 2010, at 8:04 AM, Robert Dober wrote:

> Hmm maybe I was not very clear in my last post ;)
>
> require_relative is defined in Object
>
> ruby -ve 'p method( :require_relative)'
> ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
> #<Method: Object#require_relative>
>
> ruby -ve 'p Object.method( :require_relative )'
> ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
> #<Method: Class(Object)#require_relative>
>
> However
>
> ruby -ve 'p Object.methods.grep( /require/ )'
> ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
> []
> ^^^^ ????
>
> Maybe a tiny bug here?
>
> Cheers
> R.
>
> --
> The best way to predict the future is to invent it.
> -- Alan Kay
>


No bug (in Ruby). The method is private.

$ ruby -ve 'p Object.private_instance_methods.select{|m| m.to_s =~ /
require/ }'
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin9.8.0]
[:require_relative, :require]

-Rob

Rob Biedenharn
http://agileconsultingllc.com
Rob(a)AgileConsultingLLC.com
http://gaslightsoftware.com
rab(a)GaslightSoftware.com


From: Intransition on
On Jun 4, 8:18 am, Rob Biedenharn <R...(a)AgileConsultingLLC.com> wrote:
> No bug (in Ruby). The method is private.

Damn it! I can't tell you how many time I've been bitten by that.
There REALLY needs to be a convenient way to check ALL methods,
public, private and protected.

Of course I've said this the last time this came up too, but you know,
who cares. Array#repeated_permutation is much more important.