Re-learning the library

A

Albert Schlef

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?
 
R

Robert Klemme

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
 
W

Walton Hoops

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
 
J

jtprince

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.)
 
J

J. K.

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
 
B

Brian Candler

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top