166936-167889

166708-167307 subjects 167090-256201

Proposed new feature: Drop to debugger on failed test
166936 [listrecv@gm ] I'd like to propose a simple new feature which I think could be very
+ 166938 [nobuyoshi.na] module Kernel
| 167003 [jeff.darklig] ...
+ 167012 [florgro@gm i] 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@gm i] 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@gm i] Basically it would be wonderful to have that information as part of the

The evils of 0.each
166943 [michelle@co ] Why doesn't 0 (Fixnum) support .each ?
+ 166944 [skaes@gm .n ] Probably a bug.
| 166950 [kero@ch ll .] They don't, because they're single items, not lists, sets or something.
+ 166947 [timsuth@ih g] 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@ih g] Ruby Weekly News 14th - 20th November 2005

class Dir
166951 [Fleck@sc le ] 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@sc le ] Thanks,

win32ole with 'VirtualServer.Application'?
166957 [jfc@se on t.] require 'win32ole'

Ron Jeffries implementing Extended Sets
166959 [pit@ca it in] For those of you not reading the Extreme Programming mailing list, Ron
+ 167040 [james@gr yp ] This is a great series of articles and he openly invites insights
+ 167162 [jim.menard@g] ...
| 167167 [pit@ca it in] Nice implementation, Jim! I'm curious about Ron's final solution.
+ 167720 [ronjeffries@] Thanks for posting the link, Pit.

Optimization anyone
166960 [hsanson@mo g] I have this little script that takes a list of keyword sets, each set has only
+ 166961 [decoux@mo lo] vs
| 167001 [chneukirchen] Do you know how oniguruma does that, per chance?
| 167004 [decoux@mo lo] You can compile oniguruma with debugging options
+ 166962 [bob.news@gm ] On obvious optimization is to create all regexps during
  166982 [christian.le] ...

Ruby and cygwin: supported?
166963 [Pascal.Sarto] I have tried to use ruby from the Cygwin environment under Windows. Some
166964 [bob.news@gm ] 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@gm ] You could have easily checked.
+ 166974 [hgs@dm .a .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] ...
  167211 [rpardee@gm i] alias irb='/cygdrive/c/ruby/bin/irb.bat'

newbie question
166966 [vamlists@gm ] irb(main):001:0> name = "Jasmine"
+ 166967 [m.fellinger@] charset="iso-8859-1"
+ 166968 [ruby@ml ic m] irb(main):005:0> name.sub(/#{phrase}/i, '**')
+ 166969 [bob.news@gm ] Try name.sub(/#{phrase}/i, '**')
| 166975 [vamlists@gm ] 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@se m] For Rails questions you'll want to ask the Rails list because they

Fancy a job?
166972 [grant.bodie@] London ?40 - ?45k,

Re: [Rails] Fosdem : Developers Room, Presence
166973 [riboulet@gm ] 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@ve l] <4383250f$0$13315$61c65585@un-2park-reader-01.sydney.pipenetworks.com.au
+ 166987 [fugalh@gm il] Safari doesn't like feeds from localhost. It's a real pain. You might
+ 167045 [ajwitte@gm i] 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@te re] I want to require all ruby files from a "lib" directory.  This is
166994 [bob.news@gm ] 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@gm ] Yeah, probably.
| 167015 [Daniel.Berge] Could Kernel#require be modified to understand '*' (non-recursive) and
| 167027 [ mfp@ac .o g] 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@re in ] Try the rails mailing list instead of the ruby mailing list.

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

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

Testing multiple page actions in Rails
167007 [listrecv@gm ] 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@gm ] I took a look at some RoR projects, to see how they do this.

ANNOUNCE: Puppet Beta Two
167019 [luke@ma st p] 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@mo lo] 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@ac .o g] module Foo
  167042 [Daniel.Berge] Ah, ok.  I think I can live with that for my needs. :)

debugging a cgi
167035 [maggelet@gm ] Is there a good way to get more information about what went wrong in a
+ 167036 [hhausman@gm ] So far, what I've found is that it's pretty much all about running it
+ 167037 [detlef.reich] Ehm...
  167043 [maggelet@gm ] 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@gm ] Thanks for the suggestion,
  167225 [bob_showalte] What could cause a 500 response?
  167248 [maggelet@gm ] 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@gm il] i am still learning. in the below code @attributes is a hash table. i
+ 167049 [akonsu@gm il] sorry, forgot to phrase the question. the question is is there a way to
| 167052 [lyndon.samso] ...
| 167055 [lyndon.samso] ...
| + 167062 [lyndon.samso] ...
| + 167072 [mvette13@gm ] ...
+ 167050 [mrkode@gm il] ...
| + 167056 [akonsu@gm il] 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@gm i] Hash.new([])
| + 167103 [jeff.darklig] ...
|   167106 [dblack@wo bl] 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] ...
|   | + 167109 [james_b@ne r] I love it too, and will use it simply because David said he'd never seen
|   | | 167113 [dblack@wo bl] But now I've seen it, so you don't have to :-)
|   | + 167112 [dblack@wo bl] 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@wo bl] 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] ...
|   | | + 167126 [dblack@wo bl] I'm not sure what you mean.  A wiki page of... ?
|   | | | 167130 [lyndon.samso] ...
|   | | + 167129 [james_b@ne r] Such as http://www.rubygarden.org/ruby?RubyIdioms ?
|   | |   167133 [lyndon.samso] ...
|   | |   167146 [jeff.darklig] ...
|   | |   167168 [dblack@wo bl] No argument there :-)
|   | |   167172 [bob.news@gm ] 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@pa h. ] irb(main):001:0> noargs = proc { || 3 }
|     + 167148 [ mfp@ac .o g] Maybe not for long
|     + 167166 [dblack@wo bl] Interesting.  I wonder why.  And it's yet another case where
+ 167057 [leavengood@g] (@attributes[a.key]||=[])<<a
| 167065 [akonsu@gm il] thank you. this assumes that the hash's default value is nil. but this
| 167070 [caleb@ae -t ] Note that a "Ruby" hint would be to get rid of your "is_a?",
| 167079 [mental@ry ia] It's better to use respond_to? -- if you get a NameError, you can't
+ 167067 [billk@ct .c ] @attributes = Hash.new {|h,k| h[k] = Array.new}
| + 167069 [akonsu@gm il] thanks. this form of Hash creation with blocks is not documented in
| | 167075 [desmarm@gm i] See ri Hash.new.
| | + 167076 [daniels@pr n] You can always convert it out at the end.
| | + 167080 [akonsu@gm il] sorry, what is 'ri'?
| |   167084 [desmarm@gm i] ri is a commend line program that may or may not have been installed
| + 167083 [james_b@ne r] @attributes = {}
| | 167088 [akonsu@gm il] this is something i have never seen. would you explain the 'def' line
| | + 167097 [jeff.darklig] ...
| | + 167159 [christophe.g] def @attributes.<<(obj)
| |   167170 [dblack@wo bl] There's also a (usually not too important) difference involving the
| + 167183 [gavin@re in ] 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] ...
+ 167053 [james@gr yp ] Does this help?
| 167059 [marcel@ve ni] An alternative to ('%b' % n) is n.to_s(2)
+ 167058 [vjoel@pa h. ] s = ""
| 167063 [caleb@ae -t ] num = 50
+ 167060 [uval@rz un -] irb(main):082:0> x = 7.to_s(2).split(//).map! {|bit| bit.to_i}
| 167066 [marcel@ve ni] 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@gr yp ] Another thought:  Ruby's Integers are already pretty close to a bit
+ 167087 [james@gr yp ] => [0, 0, 0, 0, 0, 1, 1, 1]
  + 167157 [curt.hibbs@g] ...
  + 167202 [leavengood@g] And the winner by a nose is.................................
    167222 [curt.hibbs@g] ...
    167269 [ed.howland@g] def to_ba(num, size=8)
    167271 [daniels@pr n] 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@mo lo] Well, ruby use the variable $LOAD_PATH to know where it must search a
+ 167156 [snail@ob me ] stevewong4@gmail.com writes

a == nil or a.nil?
167078 [akonsu@gm il] this is more of a philosophical question. my C experience makes me feel
+ 167085 [mrkode@gm il] ...
+ 167086 [eric.mahurin] == is usually meant to query whether the data in the objects are the
+ 167091 [billk@ct .c ] 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@gm i] unless a

String#to_rx ?
167089 [alex@de et m] 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] ...
  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] ...
  | 167656 [mailing-list] So in what way is String#escaped better than String#to_rx?
  | 167665 [jeff.darklig] ...
  | + 167666 [langstefan@g] But escaped for what purpose? For usage as XML attribute value?
  | | 167674 [jeff.darklig] ...
  | + 167673 [mailing-list] As Stefan Lang already pointed out, that's totally non-sensical.
  |   167680 [jeff.darklig] ...
  |   167712 [mailing-list] So you think /(?:abc)/ is easier to read than /[abc]/?  How about
  |   + 167728 [jeff.darklig] ...
  |   + 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
threads.html
top