Forum: Ruby Standard Library questions

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.
joevandyk (Guest)
on 2005-12-08 00:49
(Received via mailing list)
I'm spending an hour or two today going through Ruby's standard
library, seeing what's in there.

What the hell is WeakRef used for?  How is that useful?

Joe
joevandyk (Guest)
on 2005-12-08 00:57
(Received via mailing list)
On 12/7/05, Joe Van D. <removed_email_address@domain.invalid> wrote:
> I'm spending an hour or two today going through Ruby's standard
> library, seeing what's in there.
>
> What the hell is WeakRef used for?  How is that useful?

Also, there's hardly any documentation for Tracer.  Had to look it up
in Pickaxe2.

How does one go about creating and submitting documentation for these
things?  It's probably not acceptable to use a direct, attributed
quote from the Pickaxe book for those things, right?

Joe
jeremy (Guest)
on 2005-12-08 01:01
(Received via mailing list)
On Dec 7, 2005, at 2:46 PM, Joe Van D. wrote:
> I'm spending an hour or two today going through Ruby's standard
> library, seeing what's in there.
>
> What the hell is WeakRef used for?  How is that useful?

Consider a cache whose entries are ok to be garbage collected.

jeremy
James G. (Guest)
on 2005-12-08 01:05
(Received via mailing list)
On Dec 7, 2005, at 4:46 PM, Joe Van D. wrote:

> I'm spending an hour or two today going through Ruby's standard
> library, seeing what's in there.

That's one of my favorite pass times.  Are we uber geeks or what?  ;)

> What the hell is WeakRef used for?  How is that useful?

How about caching?  Build up a big cache for some process intensive
values, but allow GC to clean house when it needs to because you
could always refigure them.

James Edward G. II
James G. (Guest)
on 2005-12-08 01:09
(Received via mailing list)
On Dec 7, 2005, at 4:55 PM, Joe Van D. wrote:

> How does one go about creating and submitting documentation for these
> things?

Try the "About the Project" link on this page:

http://wiki.grayproductions.net/rubysourcedoc/show/HomePage

James Edward G. II
joevandyk (Guest)
on 2005-12-08 01:13
(Received via mailing list)
On 12/7/05, James Edward G. II <removed_email_address@domain.invalid> wrote:
> On Dec 7, 2005, at 4:46 PM, Joe Van D. wrote:
> > What the hell is WeakRef used for?  How is that useful?
> >
> How about caching?  Build up a big cache for some process intensive
> values, but allow GC to clean house when it needs to because you
> could always refigure them.

Ah, ok.  That info could go in the RDoc.
kyosuke (Guest)
on 2005-12-08 01:26
(Received via mailing list)
Joe Van D. wrote:
>
> How does one go about creating and submitting documentation for these
> things?  It's probably not acceptable to use a direct, attributed
> quote from the Pickaxe book for those things, right?
>
> Joe
What about this? ;-)

http://www.ruby-doc.org/stdlib/libdoc/weakref/rdoc...
http://www.ruby-doc.org/stdlib/libdoc/tracer/rdoc/index.html

Jakub
batkins57 (Guest)
on 2005-12-08 01:34
(Received via mailing list)
Yeah, I think no documentation for any of the methods would certainly
qualify as "hardly any documentation" .......
gregory.t.brown (Guest)
on 2005-12-08 01:58
(Received via mailing list)
On 12/7/05, Joe Van D. <removed_email_address@domain.invalid> wrote:
> On 12/7/05, Joe Van D. <removed_email_address@domain.invalid> wrote:
> > I'm spending an hour or two today going through Ruby's standard
> > library, seeing what's in there.
> >
> > What the hell is WeakRef used for?  How is that useful?
>
> Also, there's hardly any documentation for Tracer.  Had to look it up
> in Pickaxe2.

A few seconds in IRb got me this:

[olympic]$ irb
irb(main):001:0> require "tracer"
=> true
irb(main):002:0> Tracer.on { "Foo".to_a.reverse }
#0:(irb):2:Object:-: -
#0:(irb):2:Enumerable:>: -
#0:(irb):2:String:>: -
#0:(irb):2:String:<: -
#0:(irb):2:Enumerable:<: -
#0:(irb):2:Array:>: -
#0:(irb):2:Array:<: -
=> ["Foo"]
irb(main):003:0> Tracer.on { (1..20).to_a.reverse }
#0:(irb):3:Object:-: -
#0:(irb):3:Object:-: -
#0:(irb):3:Enumerable:>: -
#0:(irb):3:Range:>: -
#0:(irb):3:Range:<: -
#0:(irb):3:Enumerable:<: -
#0:(irb):3:Array:>: -
#0:(irb):3:Array:<: -
=> [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2,
1]
irb(main):004:0> Tracer.on { @a = 3 }
#0:(irb):4:Object:-: -
=> 3
irb(main):005:0> Tracer.on { @a }
#0:(irb):5:Object:-: -
=> 3

This looks interesting.  If I document this class where should I send
my documentation?
drbrain (Guest)
on 2005-12-08 02:18
(Received via mailing list)
On Dec 7, 2005, at 2:55 PM, Joe Van D. wrote:

> things?
Get a CVS checkout of HEAD and add the documentation to the
appropriate files.

Be sure to add or edit the appropriate .document files.

> It's probably not acceptable to use a direct, attributed
> quote from the Pickaxe book for those things, right?

You'll have to check with Dave T..  Much of the current RDoc
comes from the first pickaxe.

--
Eric H. - removed_email_address@domain.invalid - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
james_b (Guest)
on 2005-12-08 02:59
(Received via mailing list)
Joe Van D. wrote:
>
> How does one go about creating and submitting documentation for these
> things?

Hang out on ruby-doc or ruby-core  mailing list; I believe you can post
to ruby-code and get someone with commit rights to add it in if it looks
right.

 > It's probably not acceptable to use a direct, attributed
> quote from the Pickaxe book for those things, right?


Why not?    Seems like fair use.



James

--

http://www.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - Ruby Code & Style: Writers wanted
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools
James G. (Guest)
on 2005-12-08 04:00
(Received via mailing list)
On Dec 7, 2005, at 5:55 PM, Gregory B. wrote:

> If I document this class where should I send my documentation?

I already answered this question once in this thread.  ;)  Here's
what I said:

Try the "About the Project" link on this page:

http://wiki.grayproductions.net/rubysourcedoc/show/HomePage

James Edward G. II
gregory.t.brown (Guest)
on 2005-12-08 06:38
(Received via mailing list)
On 12/7/05, James Edward G. II <removed_email_address@domain.invalid> wrote:
> On Dec 7, 2005, at 5:55 PM, Gregory B. wrote:
>
> > If I document this class where should I send my documentation?
>
> I already answered this question once in this thread.  ;)  Here's

I saw this, read this, some how skipped to the wrong page, and said,
this doesn't have enough information.   Now that I'm looking at the
right stuff, I am better situated. :)
This topic is locked and can not be replied to.