166708-167307 subjects 167090-169742

^ Proposed new feature: Drop to debugger on failed test
166936 [listrecv gma] I'd like to propose a simple new feature which I think could be very
+ 166938 [nobuyoshi.na] module Kernel
| 167003 [jeff.darklig] Or, you could simply use the breakpoint library...
+ 167012 [florgro gmai] I have thought about doing it with ruby-breakpoint, but it turned out
  167017 [leavengood g] How about adding your own initialize to AssertionFailedError?
  167031 [florgro gmai] Hm, do I have access to the type of the failed assertion from there?
  167038 [leavengood g] Not really...are you sure do you need it?
  167047 [florgro gmai] Basically it would be wonderful to have that information as part of the

^ The evils of 0.each
166943 [michelle cor] Why doesn't 0 (Fixnum) support .each ?
+ 166944 [skaes gmx.ne] Probably a bug.
| 166950 [kero chello.] They don't, because they're single items, not lists, sets or something.
+ 166947 [timsuth ihug] 1#each doesn't exist either.
+ 166948 [nobuyoshi.na] Because Fixnum doesn't have the method `each'.

^ Ruby Weekly News 14th - 20th November 2005
166946 [timsuth ihug] Ruby Weekly News 14th - 20th November 2005

^ class Dir
166951 [Fleck schlei] what' s the best way to detect if a Dir entry is a directory or file? I' m doing a Dir.foreach blabla |x|.
+ 166953 [nobuyoshi.na] Dir.foreach yields just basenames.  You'll need to prefix the
+ 166958 [m.fellinger ] charset="iso-8859-1"

^ Antw: Re: class Dir
166954 [Fleck schlei] Thanks,

^ win32ole with 'VirtualServer.Application'?
166957 [jfc segonet.] require 'win32ole'

^ Ron Jeffries implementing Extended Sets
166959 [pit capitain] For those of you not reading the Extreme Programming mailing list, Ron
+ 167040 [james graypr] This is a great series of articles and he openly invites insights
+ 167162 [jim.menard g] I sent Ron the following two files to Ron a couple of days ago, and
| 167167 [pit capitain] Nice implementation, Jim! I'm curious about Ron's final solution.
+ 167720 [ronjeffries ] Thanks for posting the link, Pit.

^ Optimization anyone
166960 [hsanson moeg] I have this little script that takes a list of keyword sets, each set has only
+ 166961 [decoux moulo] vs
| 167001 [chneukirchen] Do you know how oniguruma does that, per chance?
| 167004 [decoux moulo] You can compile oniguruma with debugging options
+ 166962 [bob.news gmx] On obvious optimization is to create all regexps during
  166982 [christian.le] There's a whole section in Mastering Regular Expressions that goes into the

^ Ruby and cygwin: supported?
166963 [Pascal.Sarto] I have tried to use ruby from the Cygwin environment under Windows. Some
166964 [bob.news gmx] What exactly do you mean by this?  cygwin.com maintains a ruby package so
166965 [Pascal.Sarto] I didn't know! I just installed Ruby the "regular" way, and wanted to be
+ 166970 [bob.news gmx] You could have easily checked.
+ 166974 [hgs dmu.ac.u] Did you install rubygems in the same way as you installed your
  167101 [jqshenker gm] I ran into this problem a while ago: Uninstall your native Windowsversion, and get the cygwin version. It's really hard (impossible,maybe) to make the native version play nicely with cygwin. I also hadto recompile Ruby from source, as one of the bundled cygwin binarieskept crashing.
  167110 [davemontalvo] to invoke a win version of ruby from the cygwin shell, just add an alias to
  167211 [rpardee gmai] alias irb='/cygdrive/c/ruby/bin/irb.bat'

^ newbie question
166966 [vamlists gma] irb(main):001:0> name = "Jasmine"
+ 166967 [m.fellinger ] charset="iso-8859-1"
+ 166968 [ruby ml.icem] irb(main):005:0> name.sub(/#{phrase}/i, '**')
+ 166969 [bob.news gmx] Try name.sub(/#{phrase}/i, '**')
| 166975 [vamlists gma] Got it. Thanks all!
+ 166985 [w_a_x_man ya] irb(main):013:0> phrase = /ja/i

^ [rails] Access to @session object from model
166971 [mj-usunto tk] I'm using login_generator as authentication mechanism.
167034 [drbrain segm] For Rails questions you'll want to ask the Rails list because they

^ Fancy a job?
166972 [grant.bodie ] London 0 - 45k,

^ Re: [Rails] Fosdem : Developers Room, Presence
166973 [riboulet gma] Thom/ange

^ problem  installing rails with rake/gem
166977 [krishna.vive] I am a newbie to ruby and gems and rails ..

^ Testing RSS feeds on Tiger
166981 [ratkins_usen] I'm trying to write a RoR program to create an RSS feed. I'm pretty sure
+ 166986 [reinder verl] <4383250f$0$13315$61c65585@un-2park-reader-01.sydney.pipenetworks.com.au
+ 166987 [fugalh gmail] Safari doesn't like feeds from localhost. It's a real pain. You might
+ 167045 [ajwitte gmai] Safari has a bug prevents viewing feeds unless there's at least one dot

^ There must be a better way -- requiring multiple files
166993 [dteare teare] I want to require all ruby files from a "lib" directory.  This is
166994 [bob.news gmx] Dir[File.join(__FILE__, "..", "..", "lib", "*.rb")].each {|l| require l}
166999 [langstefan g] I have come to the conclusion that the following syntax makes
+ 167008 [bob.news gmx] Yeah, probably.
| 167015 [Daniel.Berge] Could Kernel#require be modified to understand '*' (non-recursive) and
| 167027 [ mfp acm.org] You could add to them that it'd pose some problems with RubyGems' new
| 167030 [halostatue g] Yeah, but I think that there are enough potential problems with the
+ 167039 [w_a_x_man ya] I think that all unix-influenced programs that I use  under

^ rails w/ fast-cgi
166995 [stakadush gm] i give up :)
167199 [gavin refine] Try the rails mailing list instead of the ruby mailing list.

^ PLATFORM tests
167002 [eule space.c] Dear list,
167010 [bob.news gmx] Now, how do you classify that?  Normally I'd say unix but there might be
+ 167011 [Daniel.Berge] cygwin != windows
| 167016 [peter semant] Not really that odd, "a Unix like environment" and "unixy behaviour"
| 167020 [mental rydia] Precisely.  Tests for specific platforms are almost worthless -- you
| + 167149 [damphyr free] OK, how do we test that win32ole and winapi are valid choices for cygwin
| | 167291 [mental rydia] If you're building Ruby, autoconf tests or similar.
| + 167417 [kero chello.] Duck platforming
|   167431 [mental rydia] BINGO.
|   167434 [james_b neur] Which, for example, is a preferred way to do cross-browser JavaScript
+ 167014 [langstefan g] Platform.unix?    # => true
+ 167150 [eule space.c] This actually supports my case in that libraries should really be written
  167192 [luke madstop] I also have a relatively small library called 'facter' that is a bit more
  167208 [eule space.c] Your library looks tremendously useful for a certain kind of work. I am

^ ferret: wildcard field search dies
167005 [itsme213 hot] irb(main):001:0> require 'ferret'

^ Testing multiple page actions in Rails
167007 [listrecv gma] Some actions in Rails require sessions spanning multiple pages.  Things
167009 [greg.kujawa ] You might have better results posting this to the Rails mailing list at
167028 [listrecv gma] I took a look at some RoR projects, to see how they do this.

^ ANNOUNCE: Puppet Beta Two
167019 [luke madstop] After far too long, a new release of Puppet is out.

^ C extensions and class constants nested within modules
167021 [Daniel.Berge] module Foo
167023 [decoux moulo] Because this is parse.y and eval.c which make work
167026 [Daniel.Berge] What's the difference between these two?
+ 167032 [chneukirchen] You could hit issues with constant lookup, but from a code point
+ 167033 [ mfp acm.org] module Foo
  167042 [Daniel.Berge] Ah, ok.  I think I can live with that for my needs. :)

^ debugging a cgi
167035 [maggelet gma] Is there a good way to get more information about what went wrong in a
+ 167036 [hhausman gma] So far, what I've found is that it's pretty much all about running it
+ 167037 [detlef.reich] Ehm...
  167043 [maggelet gma] Thanks for the suggestions, however running from the shell and viewing
  167046 [bob_showalte] I'm not an expert on this, but why not wrap your entire script in
  167220 [maggelet gma] Thanks for the suggestion,
  167225 [bob_showalte] What could cause a 500 response?
  167248 [maggelet gma] The idea is to make debugging cgi's easier. Yes I can check it on

^ what is the ruby way to do this?
167048 [akonsu gmail] i am still learning. in the below code @attributes is a hash table. i
+ 167049 [akonsu gmail] sorry, forgot to phrase the question. the question is is there a way to
| 167052 [lyndon.samso] $hash =3D {}
| 167055 [lyndon.samso] and this monstrosity, which isn't in the spirit of ruby... :-)
| + 167062 [lyndon.samso] And finally I get to
| + 167072 [mvette13 gma] Personally, I would keep every element of the hash an array. You can do tha=
+ 167050 [mrkode gmail] Pardon my question, but isn't the whole point of hashes that every key is
| + 167056 [akonsu gmail] yes, this is the point of hashes. in my program, i have attributes with
| | + 167061 [leavengood g] In my opinion it is better to just put all the attributes into an
| | + 167064 [kennethkunz ] Konstantin,
| |   167073 [desmarm gmai] Hash.new([])
| + 167103 [jeff.darklig] I would do
|   167106 [dblack wobbl] I believe that's the first empty || I've ever seen.  It's awfully
|   + 167107 [ara.t.howard] i must confess i love it!  probably won't use it much.  but i love it.
|   | + 167108 [jeff.darklig] ok ...
|   | + 167109 [james_b neur] I love it too, and will use it simply because David said he'd never seen
|   | | 167113 [dblack wobbl] But now I've seen it, so you don't have to :-)
|   | + 167112 [dblack wobbl] Keep it firmly in mind if there's every another obfuscated Ruby
|   | + 167114 [leavengood g] Yeah that is nuts...but I really like it :)
|   |   167117 [dblack wobbl] Et tu, Leavengood? :-)
|   |   167120 [leavengood g] ROFL. Yes indeed. I have yet to really reveal it, but I have quite a
|   + 167121 [rascal1182 g] Perhaps I'm missing something.  Is there something wrong with the following?
|   | + 167123 [lyndon.samso] It would be nice if there was a wiki page somewhere of these Uberdioms...
|   | | + 167126 [dblack wobbl] I'm not sure what you mean.  A wiki page of... ?
|   | | | 167130 [lyndon.samso] Sorry :-)
|   | | + 167129 [james_b neur] Such as http://www.rubygarden.org/ruby?RubyIdioms ?
|   | |   167133 [lyndon.samso] Nice RaDD work ( Rapid Documentation Development ) !
|   | |   167146 [jeff.darklig] Heh, and to think the only reason I did it was because I figured just havin=
|   | |   167168 [dblack wobbl] No argument there :-)
|   | |   167172 [bob.news gmx] Note though that this idiom will most likely lead to surprising results
|   | + 167127 [leavengood g] No that is how it works and that is basically what Jeff's code does.
|   + 167131 [vjoel path.b] irb(main):001:0> noargs = proc { || 3 }
|     + 167148 [ mfp acm.org] Maybe not for long
|     + 167166 [dblack wobbl] Interesting.  I wonder why.  And it's yet another case where
+ 167057 [leavengood g] (@attributes[a.key]||=[])<<a
| 167065 [akonsu gmail] thank you. this assumes that the hash's default value is nil. but this
| 167070 [caleb aei-te] Note that a "Ruby" hint would be to get rid of your "is_a?",
| 167079 [mental rydia] It's better to use respond_to? -- if you get a NameError, you can't
+ 167067 [billk cts.co] @attributes = Hash.new {|h,k| h[k] = Array.new}
| + 167069 [akonsu gmail] thanks. this form of Hash creation with blocks is not documented in
| | 167075 [desmarm gmai] See ri Hash.new.
| | + 167076 [daniels pron] You can always convert it out at the end.
| | + 167080 [akonsu gmail] sorry, what is 'ri'?
| |   167084 [desmarm gmai] ri is a commend line program that may or may not have been installed
| + 167083 [james_b neur] @attributes = {}
| | 167088 [akonsu gmail] this is something i have never seen. would you explain the 'def' line
| | + 167097 [jeff.darklig] It's defining the << operator on the @attributes object
| | + 167159 [christophe.g] def @attributes.<<(obj)
| |   167170 [dblack wobbl] There's also a (usually not too important) difference involving the
| + 167183 [gavin refine] Hey, thanks for that! I had no idea that the block form of Hash
+ 167105 [joevandyk gm] Hopefully there isn't anyone who isn't!

^ How convert an integer to a bit array
167051 [curt.hibbs g] Does anyone have a clever way to convert an integer to an array of bit
+ 167053 [james graypr] Does this help?
| 167059 [marcel verni] An alternative to ('%b' % n) is n.to_s(2)
+ 167058 [vjoel path.b] s = ""
| 167063 [caleb aei-te] num = 50
+ 167060 [uval rz.uni-] irb(main):082:0> x = 7.to_s(2).split(//).map! {|bit| bit.to_i}
| 167066 [marcel verni] x.unshift(0) until (x.size % 8).zero?
| 167068 [Daniel.Berge] Nah, that's too much work.
+ 167071 [leavengood g] class Integer
| 167081 [leavengood g] user     system      total        real
+ 167082 [james graypr] Another thought:  Ruby's Integers are already pretty close to a bit
+ 167087 [james graypr] => [0, 0, 0, 0, 0, 1, 1, 1]
  + 167157 [curt.hibbs g] You guys are awesome... so many good ideas here!
  + 167202 [leavengood g] And the winner by a nose is.................................
    167222 [curt.hibbs g] Cool!  Thanks for doing the benchmark.
    167269 [ed.howland g] def to_ba(num, size=8)
    167271 [daniels pron] Integer#[]  8 times
    167273 [ed.howland g] I saw that you were right. I used require 'benchmark' and 100,000 and

^ [ANN] Rant 0.5.0
167054 [langstefan g] Rant is a flexible build tool written entirely in Ruby,

^ Help embedding Ruby in Visual C++ project
167074 [stevewong4 g] I am trying to embed Ruby within a Visual C++ project, but I am having
+ 167155 [decoux moulo] Well, ruby use the variable $LOAD_PATH to know where it must search a
+ 167156 [snail objmed] stevewong4@gmail.com writes

^ a == nil or a.nil?
167078 [akonsu gmail] this is more of a philosophical question. my C experience makes me feel
+ 167085 [mrkode gmail] for readability, I wager.
+ 167086 [eric.mahurin] == is usually meant to query whether the data in the objects are the
+ 167091 [billk cts.co] 5.times {print "Hello!"}
+ 167116 [lthiryidontw] By the way,
+ 167119 [rascal1182 g] If you're not feeling the nil methods, remember nil is the only
  167132 [rampant gmai] unless a

^ String#to_rx ?
167089 [alex deletem] Possible RCR: would anyone else find this a useful addition to the core
+ 167111 [transfire gm] class String
| 167173 [halostatue g] I disagree that either #to_re or #to_rx would be a good name for this
| 167204 [transfire gm] The problem here is largely one of brevity. Who wants to type all that
| 167207 [halostatue g] Because neither #to_re nor #to_rx are expressive enough. As such, they
| 167216 [transfire gm] #regesc is better, thanks.
| 167217 [halostatue g] I've looked through the docs. There's so much there that I can get
+ 167328 [mailing-list] Please, everyone read http://www.perl.com/pub/a/2002/06/04/apo5.html and
  167549 [jeff.darklig] I believe the Facets project already contains a method like this for String
  167572 [mailing-list] [me discussing the merits of a better regex syntax over having #to_*
  167625 [transfire gm] nikolai,
  167630 [mailing-list] There are two possible solutions as I see it that make more sense than
  + 167632 [jeff.darklig] How does this differ from embedding variables in regular expressions now with
  | 167635 [transfire gm] Jeff,
  | 167638 [jeff.darklig] I didn't want them to be ... I wanted the body of the string to be
  | 167639 [jeff.darklig] Although I am surprised there isn't a String#escape ( or maybe #escaped ) method
  | 167651 [mailing-list] Did you even read this thread?  That's what was being proposed, see the
  | 167653 [jeff.darklig] Yes I did read the original thread.
  | 167656 [mailing-list] So in what way is String#escaped better than String#to_rx?
  | 167665 [jeff.darklig] On 11/27/05, Nikolai Weibull <mailing-lists.ruby-talk@rawuncut.elitemail.or=
  | + 167666 [langstefan g] But escaped for what purpose? For usage as XML attribute value?
  | | 167674 [jeff.darklig] Quite true. And comparatively, Regexp.escape does make more sense.
  | + 167673 [mailing-list] As Stefan Lang already pointed out, that's totally non-sensical.
  |   167680 [jeff.darklig] I do agree that I should have reviewed the document before posting a
  |   167712 [mailing-list] So you think /(?:abc)/ is easier to read than /[abc]/?  How about
  |   + 167728 [jeff.darklig] No further response. There isn't a point. I've stated my opinion, you've
  |   + 167740 [w_a_x_man ya] irb(main):020:0> b.scan /(\d+){ |val| val > 2 }/
  |   | 167759 [transfire gm] So I'll put in the (likely) last 2 cents. I agree with Nikolai if that
  |   + 167818 [halostatue g] On 11/27/05, Nikolai Weibull
  |     167828 [mailing-list] No, but what we call regular expressions aren't in any way regular
  |     167847 [eric.mahurin] On 11/28/05, Nikolai Weibull
  |     167862 [mailing-list] That's a valid point.
  |     167889 [eric.mahurin] On 11/28/05, Nikolai Weibull
  + 167633 [transfire gm] Thanks,  I glanced over the synopisis...and whoa! that's a lot of