It is intentional. In Ruby 1.9, method names are always returned as
symbols. Ruby 1.8.7+ returns strings and that can not be changed
because this would not be compatible.

Other implementations should do the same, and RubySpec should reflect
that duality (indeed Method#name specs are wrong for 1.8.7, I'll fix
them now). Note that mspec has the helper have_method which works for
both Ruby 1.8 and 1.9, e.g. "some_result.should
have_method(:some_method)"

On Tue, Sep 29, 2009 at 11:05 AM, Vladimir Sizikov <vsizikov / gmail.com> wro=
te:
> Hi everybody,
>
> I'd like to ask for clarification about Method#name behavior. This
> comes from rubyspec area.
>
> In MRI 1.8.7, Method#name returns a String. And the ruby-docs says so
> as well. Some time in the past, MRI 1.9 was also =A0returning strings,
> it seems. But then, the behavior in 1.9 has been changed to return a
> Symbol.
>
> So, in short:
> 1. 1.8.7: #name returns strings. #methods returns array of strings.
> 2. 1.9: #name returns symbols. #methods returns array of symbols.
>
> Seems consistent across the same versions.
> Is that how it is supposed to be?
>
> But if we are considering 1.8.7 as a step towards 1.9, maybe the
> behavior should be the same for 1.9 and 1.8.7+ branch?
>
> P.S. For various non-MRI implementations, it seems that some return
> strings, and others return symbols, so it would be good to clarify
> this once and for all.
>
> Thanks,
> =A0--Vladimir
>
>