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.
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 joevandyk (Guest)
on 2005-12-07 23: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
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 joevandyk (Guest)
on 2005-12-07 23:57
(Received via mailing list)
On 12/7/05, Joe Van Dyk <joevandyk@gmail.com> 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
24d2f8804e6bb4b7ea6bd11e0a586470?d=identicon&s=25 jeremy (Guest)
on 2005-12-08 00:01
(Received via mailing list)
On Dec 7, 2005, at 2:46 PM, Joe Van Dyk 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
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2005-12-08 00:05
(Received via mailing list)
On Dec 7, 2005, at 4:46 PM, Joe Van Dyk 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 Gray II
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2005-12-08 00:09
(Received via mailing list)
On Dec 7, 2005, at 4:55 PM, Joe Van Dyk 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 Gray II
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 joevandyk (Guest)
on 2005-12-08 00:13
(Received via mailing list)
On 12/7/05, James Edward Gray II <james@grayproductions.net> wrote:
> On Dec 7, 2005, at 4:46 PM, Joe Van Dyk 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.
461b1da26b6b198ef014235928576d81?d=identicon&s=25 kyosuke (Guest)
on 2005-12-08 00:26
(Received via mailing list)
Joe Van Dyk 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
A70a5e80f81077fb5181b6104fffa891?d=identicon&s=25 batkins57 (Guest)
on 2005-12-08 00:34
(Received via mailing list)
Yeah, I think no documentation for any of the methods would certainly
qualify as "hardly any documentation" .......
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 gregory.t.brown (Guest)
on 2005-12-08 00:58
(Received via mailing list)
On 12/7/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
> On 12/7/05, Joe Van Dyk <joevandyk@gmail.com> 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?
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Guest)
on 2005-12-08 01:18
(Received via mailing list)
On Dec 7, 2005, at 2:55 PM, Joe Van Dyk 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 Thomas.  Much of the current RDoc
comes from the first pickaxe.

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
Bc6d88907ce09158581fbb9b469a35a3?d=identicon&s=25 james_b (Guest)
on 2005-12-08 01:59
(Received via mailing list)
Joe Van Dyk 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
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2005-12-08 03:00
(Received via mailing list)
On Dec 7, 2005, at 5:55 PM, Gregory Brown 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 Gray II
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 gregory.t.brown (Guest)
on 2005-12-08 05:38
(Received via mailing list)
On 12/7/05, James Edward Gray II <james@grayproductions.net> wrote:
> On Dec 7, 2005, at 5:55 PM, Gregory Brown 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.