Package, a future replacement for setup.rb and mkmf.rb

ruby

    Next

  • 1. Dramatic SPAM increase on RubyForge ML's
    I recently (within the last few days) increase in the volume of emails ending up in my spam folder. On investigation, I discovered that over 90% of my spam was sent to the "owner" of a RubyForge project mailing list (for example, freeride-cvsevents-owner and rubyinstaller-announce-owner). I'm assuming that all other RubyForge ML owners are experienc ing the same thing. Since I *never* get legitimate email to these addresses, I'm going to change the "owner" of each of my MLs to a bogus email address. Tom, will this had an adverse impact on RubyForge and, if so, is there an alternative? Curt
  • 2. regular expressions galore
    regexps can be so confusing, i need help on this one.. - i want one regexp to match a possible colon at the start (but no more), followed by multiple word characters, or the following: / ' " # $ @ - another regular expression should match the opposite, no colon at the start (but possibly colon later), followed by characters other than the characters shown above. so far, i've got this: /^:?[\w|\/|\'|\"|#|$|@]+/ and /^[^:]([^\w|\/|\'|\"|#|$|@]|:)+/ and it's not working :-( can anyone enlighten my troubled mind? greetings, Dirk.
  • 3. sort on multiple attributes
    Hi, Just thought I'd write this to the list, since it wasn't immediately obvious to me how to do it and I couldn't find it written anywhere on the web.. Say you have an array of these music tracks: Track = Struct.new("Track", :name, :artist, :album, :track_number) ..and you want to sort the array first by artist, then by album within that artist and finally by track number within the album, this can still be done by a pretty neat sort block: sorted_tracks = tracks.sort do |a,b| if a.artist != b.artist a.artist <=> b.artist elsif a.album != b.album a.album <=> b.album else a.track_number.to_i <=> b.track_number.to_i end end Terje
  • 4. Comparing Classes with Case ?
    The following failure surprised me: Version 1: irb(main):068:0> "hi".class == "hi".class => true irb(main):069:0> "hi".class === "hi".class => false Version 2: irb(main):055:0> case "whatever".class irb(main):056:1> when String irb(main):057:1> p "it is a string" irb(main):058:1> else irb(main):059:1* p "it is not a string" irb(main):060:1> end "it is not a string" What it amounts to is you can't use case/when to test for class. This is a HUGE LOSE. The pickaxe book .chm says YOU CAN do it. I'm using ruby 1.8.2 Warren

Return to ruby

 

Who is online

Users browsing this forum: No registered users and 69 guest