Re-learning the library

Hello.

After a long time I haven’t touched Ruby I want to come back. I want to
refresh my memory about the various methods that come with the built-in
classes; e.g., String, Array, Hash. So I do, for example, “ri String”
and here’s a problem: I get a long list of methods but some of them are
defined by some gem or 3rd party library. That’s a problem, because I
want to see only the methods defined by Ruby itself. How do I do this?

On Mon, Feb 21, 2011 at 3:29 PM, Albert S. [email protected]
wrote:

After a long time I haven’t touched Ruby I want to come back. I want to
refresh my memory about the various methods that come with the built-in
classes; e.g., String, Array, Hash. So I do, for example, “ri String”
and here’s a problem: I get a long list of methods but some of them are
defined by some gem or 3rd party library. That’s a problem, because I
want to see only the methods defined by Ruby itself. How do I do this?

Create a clean installation without any gems?

Cheers

robert

ri --no-gems Enumerable#collect # --no-system --no-site --no-home
etc.

On 02/21/2011 07:29 AM, Albert S. wrote:

Hello.

After a long time I haven’t touched Ruby I want to come back. I want to
refresh my memory about the various methods that come with the built-in
classes; e.g., String, Array, Hash. So I do, for example, “ri String”
and here’s a problem: I get a long list of methods but some of them are
defined by some gem or 3rd party library. That’s a problem, because I
want to see only the methods defined by Ruby itself. How do I do this?

I’d recommend browsing http://rdoc.info/stdlib

After a long time I haven’t touched Ruby I want to come back. I want to
refresh my memory about the various methods that come with the built-in
classes; e.g., String, Array, Hash. So I do, for example, “ri String”
and here’s a problem: I get a long list of methods but some of them are
defined by some gem or 3rd party library. That’s a problem, because I
want to see only the methods defined by Ruby itself. How do I do this?

ri --no-gems Enumerable#collect
ri --help # for controls (–no-system --no-site --no-home etc.)

i use a short program for methods…

info = String #(or whatever)
puts “Methods:”
puts info.methods.sort
puts
puts “Instance Methods:”
puts info.instance_methods.sort

if you don’t require anything, this should only give you the ruby
methods…

  • j

J. K. wrote in post #983090:

i use a short program for methods…

info = String #(or whatever)
puts “Methods:”
puts info.methods.sort
puts
puts “Instance Methods:”
puts info.instance_methods.sort

if you don’t require anything, this should only give you the ruby
methods…

Or a quick one in irb:

foo = “”
foo.methods - Object.methods

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs