Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby Weekly News 22nd - 28th August 2005

Thread Tools

Ruby Weekly News 22nd - 28th August 2005

Tim Sutherland
Posts: n/a

Ruby Weekly News 22nd - 28th August 2005

Ruby Weekly News is a summary of the week's activity on the ruby-talk
mailing list / the comp.lang.ruby newsgroup, brought to you by
Tim Sutherland.

Articles and Announcements

* beaten to the punch, and a request

pat eyler is writing a Rake tutorial for IBM (to be published in 2-3

"Does anyone have an interesting, useful rake task or rule they'd be
interested in sharing?"

* Euruko 05: T-Shirts

Stefan Schmiedl said that people who signed up to the Euruko
conference early would receive t-shirts. "Please also sign up if you
want to give a talk."

Euruko is the European Ruby Conference, which this year is held on
October 15 and 16 in Munich.


Interesting threads included

Ruby 2

Alexander Fleck asked about the status of Ruby 2, and whether he will have
to throw out all his existing code when it is released.

Trans said that Ruby 1.9 (the current `development' version) is

"And most of your scripts will run fine, though there may be some small
changes to be made. From what I can tell Matz is pretty hard nosed about
backward compatibilites."

Gateway Broken (Aug 25, 2005)

Daniel Berger reported that the `comp.lang.ruby ruby-talk' gateway
appeared to be broken.

The gateway is responsible for forwarding messages from the newsgroup to
the mailing list, and vice versa.

ts said "Perhaps it's a coincidence but the gateway stopped when
greylisting was set up." (As a guard against spam.)

(ruby-core discussion indicated that it was indeed related to this. The
problem has now been fixed.)

string =~ string expressions

Mark James quoted and PickAxe 1 as saying that he should be
able to do

"cat o' 9 tails" =~ "\\d"

# This actually produces the error
# `=~': type mismatch: String given (TypeError)

Robert Klemme said that the behaviour changed between Ruby 1.6 and 1.8.
Ruby 1.8 requires one of the arguments to be a regular expression, and the
other to be a string.

The reason for the change is that the old behaviour could be ambiguous.
For example,

'foo' =~ 'bar'
/foo/ =~ 'bar'
'foo' =~ /bar/

Would the first line be equivalent to the second or the third? (In Ruby
1.6, it was the third. Did you guess right?)

Chris Game noted that the change is mentioned on page 69 of the second
edition of the PickAxe book.

He quoted: "In previous versions of Ruby, both [operands] could be
strings, in which case the second operand was converted into a regular
expression behind the scenes".

KDevelop Ruby Debugger

Martin Ankerl: "Hi everyone, today I found out that kdevelop has the best
Ruby debugger I have ever seen and thought I must tell everyone about this

He gave a link to a nice looking screenshot from

One-Click Installer: iconv, curses

Dave Burt packaged up Iconv and Curses for users of the Windows One-Click

The packages include everything you need to utilise these two libraries.

Iconv is used to translate strings between various encodings, while Curses
provides support for character-based user interfaces.

This will be very useful: discussions around Ruby's Unicode support will
say "use iconv, unless you're on Windows" no longer!

ANN: MRW online demo

Phlip said that MiniRubyWiki can now host graphical acceptance tests.

MiniRubyWiki has for some time allowed you to specify data for unit tests
in a wiki format, making it easy for non-programmers to take on this task.

With the new feature, pages can contain screenshots that will be manually
checked by a human.

| High Moon Studios uses this rig to test DarkWatch. You change Lua
| script, hit Test, and their game runs on the server and collects a
| screenshot of the hero springing some trap in the game.
| Forget games. Imagine if you need to localize a GUI to 10 languages. You
| configure the same test suite to run in each language, taking screen
| shots as it goes. Then you tell your linguists to review all the
| outputs, looking for all the little typos and missing ` marks that we
| gringos wouldn't notice.

PL/Ruby in untrusted form?

Robby Russell posted a couple of blog entries; PL/Ruby loves RubyGems and
DRb and Installing untrusted PL/Ruby for PostgreSQL.

They both discuss PL/Ruby, the library that allows you to write Ruby
stored procedures for PostgreSQL.

By default the library will run under $SAFE = 12. This is necessary to
prevent users from writing procedures that use methods like system to do
things they shouldn't be allowed to.

Robby experimented with building the library to run against $SAFE = 0
(anything goes).

This allowed him to write procedures like:

CREATE FUNCTION redcloth(text) RETURNS text AS '

require ''rubygems''
require ''redcloth''

content = args[0]

rc =

return rc.to_html

' LANGUAGE 'plruby';

Example usage:

SELECT redcloth('*strong text* and _emphasized text_');

More evily, he went on to write a function that used DRb to make a remote
call from within a stored procedure.

See also the RedHanded post.

define_method allowing any name?

gabriele renzi found that it was possible to define methods via
define_method having names that were not allowed by def.

e.g. in irb

>> class C
>> define_method " ^_^ " do "happy!" end
>> end

=> #<Proc:0x02988088@(irb):6>
>> " ^_^ "

=> "happy!"

"I think this behaviour should be prohibited (but on the other hand it
opens great possibilities "

Trans thought that there was nothing wrong with this behaviour, and
furthermore, that"^_^" could be useful for DSLs (Domain-Specific

gabriele: "well, I think most reasonable DSLs should use proper words not
punctuation, but I'd appreciate an Emoticon Specific Language "

Variable value "dump"

Brian Takita had an idea for improving the logging of exceptions in his
application. It required the ability to capture the values of local

He followed up saying he had found a solution using the local_variables
method (part of the Kernel module). Dave Burt concised it:

local_variables.each {|name| puts name + "=" + eval(name).inspect }

Daniel Schierbeck suggested that be purchased for our lady in
crimson. (May She Bless us in Her Radiance.)

He noted that is being used as an email domain, so it is unlikely
that we could get control of that one.

Matz: "I have mailed the owner of about two years ago, and got no
response. Perhaps I should have shown him (big amount of) money."

(Johan Toki Persson said "How about establishing a foundation of some
sort, dealing with donations and such?". "RubyCentral" exclaimed Timothy
Hunter and David A. Black.)

nobu observed that would be an even shorter domain. "Nobody
in Belarus? "

Anatol Pomozov: "I am from belarus. It is great idea "

Jared Nuzzolillo purchased, and, and offered to donate them to the Ruby community.

"Obviously, they cannot be the `main' domains, but I think they're cool

luke dot: "i wonder if the people would let us have ; )".

Phil Tomson: "Is there a .rb country code? ruby.rb Perhaps we should bet
Ruby delcared it's own country with it's own .rb tld."

George Ogata: " I'd just like to point out that is still
available. "

BoilerPlate 0.2.0 -- easy data-centric applications on Rails

Michael Schuerig announced a new release of BoilerPlate. This is a
framework on top of Rails "that is intended to make development of
data-centric applications as easy as possible."

It's like a super-souped-up version of Rails' scaffolding. Instead of
simple HTML pages though, it provides a pretty, rich, AJAX'ed interface.
Unlike Rails' scaffolded views, it also provides an interface for managing
relationships such as manymany.

No Keys, nor other hash methods on multidimensional hash

Auto-vivifying hashes lurk inside.

hash_factory = lambda { {|h,k| h[k] = }}

hash =
hash[1][2][3] = "foo"
# -> { 1 => { 2 => { 3 => "foo" } } }

job posting ok?

Steve Conover: "I checked the c.l.r. faq and didn't find any restrictions
on job posting, I just wanted to confirm that it's ok before I go ahead...

Phil Tomson said that if it was Ruby-related then it should be okay,
although "....of course, in a year or two if we start having several job
postings/day the sentiment could change."

File in which Module or Class is defined

Trans: "Is there a built in way to find out what file a class or module is
*initially* defined in?"

Robert Klemme said that the following could be used:

class Class
def inherited(cl) cl.const_set("FILE", caller[-1].freeze) end

Then you can look at Foo::FILE for each subsequently defined class Foo.

HTTP, client cookie and client form handling

Yannick Turgeon was going to be writing a Ruby script to login to the
Yahoo website and extract some information from pages therein.

He enquired as to whether there were any libraries for doing this, apart
from the lower-level Net::HTTP, which for example does not do anything
special with cookies.

Aleksi gave links to three libraries: WebFetcher, Mechanize and

Yannick ended up using Mechanize.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruby Weekly News 28th November - 4th December 2005 Tim Sutherland Ruby 1 12-06-2005 09:39 AM
Ruby Weekly News 16th - 22nd May 2005 Tim Sutherland Ruby 0 05-26-2005 11:16 AM
Ruby Weekly News 28th March - 3rd April 2005 Tim Sutherland Ruby 6 04-07-2005 02:43 AM
Ruby Weekly News 28th February - 6th March 2005 Tim Sutherland Ruby 1 03-07-2005 07:42 PM
Ruby Weekly News 22nd-28th November 2004 Tim Sutherland Ruby 0 11-30-2004 10:04 AM