Ruby Weekly News 12th - 18th September 2005


Tim Sutherland

Ruby Weekly News 12th - 18th September 2005

Ruby Weekly News is a summary of the week's activity on the
ruby-talk mailing list <=> comp.lang.ruby newsgroup,
brought to you this week by Tim Sutherland and Christophe Grandsire.

Articles and Announcements

* Registration for RubyConf 2005 is now CLOSED!

David A. Black: "Registration for RubyConf 2005 is now closed. We have
reached full capacity, based on paid registrations."

| Any registration fees we receive from this point on will be refunded
| to you, minus processing fees if any.

* Job site

Jason Toy announced a website created by himself and John Li for
posting and finding Ruby related jobs. was created using Rails and PostgreSQL.

James Edward Gray II: "How funny! You just stole the Ruby Quiz idea
for tomorrow."

* Article: The Fine Art of Computer Programming

Christophe Grandsire linked to an article from the Free Software
Magazine entitled "The Fine Art of Computer Programming".

| Since fun in programming is a recurrent theme among Rubyists, and
| there is quite a culture among us of clear, readable code, I thought
| it might interest some people here.

User Group News

* The 2nd Hamburg.rb meeting in September

Hamburg.rb are meeting more often, with September 21st being the
second one of the month.

* Boston.rb Meeting Tonight!

"Tonight" = September 13th, so if you're a Bostonite who is hearing
about this for the first time then you'll have to wait for the next

* LA Ruby Meetup

Joshua IT Smith announced that work was being done to organise an LA
Ruby group. The first meeting is scheduled for October 13, 2005.


detaching required scripts

MiG's application used .rb files to represent `plugins' that could be
loaded and unloaded, with each one containing a module definition.

The application implemented unloading by calling remove_const to remove
the module, however attempts to then re-require the plugin would fail,
because Ruby, noting that the file has already been required, won't load
it again.

Lyndon Samson pointed out that you could just use load instead of require
in this case. The latter un-conditionally loads the file without worrying
about whether the file has already been seen.

ruby-dev summary 26862-26956

Masayoshi Takahashi summarised the Japanese list ruby-dev, "in these

Inside is Enumerable#count with block, String tainting, and a patch from
nobu to return an Enumerator for methods like Array#each when they are
called without a block.

ruby and aop

Ever written code like this?

class OneTreeHill < TheDomain
alias old_tree tree

def tree
warn("No longer any tree")

Did you feel wrong and dirty? Dirty and wrong? Had nightmares about
someone else also wrapping the same method in the same way?

gabriele renzi reminded us of an article by Mauricio Fernandez from 2004
that shows how to do it in a nicer way, by using instance_method and

class OneTreeHill < TheDomain

prev = instance_method:)tree)

define_method:)tree) do
warn("No longer any tree")


Even better, with Module#wrap_method from the Ruby Facets project:

require 'facet/module/wrap_method'

class OneTreeHill < TheDomain
wrap_method:)tree) do |old|
warn("No longer any tree")

The thread discussed several points related to AOP (Aspect-Oriented
Programming) in Ruby.

gsub(/Ads by Goooooogle/, "PayPal DONATE").suggest?

x1 thought it would be better to have a `donate' option on rather than the current Google ads, and
personally offered to give USD$100 if this was done.

James Britt said that it was possible to donate at Ruby Central.

David Brady:

| I know all ads are annoying, but Adsense seems to be the least obtrusive
| of the lot. I have no idea what is making but all of my
| sites typically make $US5-20 per month per thousand daily visitors. All
| of my sites are running donations as well; adding Adsense had no effect
| on donation rates. So if is pulling 20k daily visitors,
| that's somewhere around $US200 of "free money" to help pay for hosting.

James Britt: "Does get 20K daily visits?"

Gavin Kistner: "Hell, does get 20k *monthly* visits?"

How much money is gained from the ads? How many people would be willing to
make a donation if it meant getting rid of the ads?

Ruby Jobs Site (#47)

James Edward Gray II's Ruby Quiz for the week:

| When I first came to Ruby, even just a year ago, I really doubt the
| community was ready to support a Ruby jobs focused web site. Now though,
| times have changed. I'm seeing more and more posting about Ruby jobs
| scattered among the various Ruby sites. Rails has obviously played no
| small part in this and the biggest source of jobs postings is probably
| the Rails weblog, but there have been other Ruby jobs offered recently
| as well.
| Wouldn't it be nice if we had a centralized site we could go to and scan
| these listings for our interests?

Develop such a site, using whichever Ruby tools you choose.

implode function?

Julian Leviston asked if Ruby had anything like PHP's implode function.

It would work like:

z = %w[yeah cool mad awesome funky]
z.implode(', ') # -> 'yeah, cool, mad, awesome, funky'

"I guess I'll just go write one."

No need, thanks to Array#join:

z = %w[yeah cool mad awesome funky]
z.join(', ') # -> 'yeah, cool, mad, awesome, funky'

Florian Frank noted that String#* can also be used here:

z = %w[yeah cool mad awesome funky]
z * ', ' # -> 'yeah, cool, mad, awesome, funky'

This led Martin DeMello to say that its a shame there is no String#/. Of
course, Florian then popped back in with "Ha, now there is", making / an
alias for split.

Get to the Point: Ruby and Rails Presentation Slides

John W. Long and Ryan Platte's uploaded their introduction to Ruby and
Rails presentation slides that they used at the Chicago ACM.

"Comments and suggestions are welcome. We would like to present this again
in the future, so it would be good to clarify things a little."

website screen scraping with Mechanize or Rubyful Soup

Dan Kohn was trying to do some website "screen scraping" - i.e. write a
script that acts like a web browser, submitting forms and extracting data
from web-pages.

He had come across WWW::Mechanize and Rubyful Soup which looked useful,
however he couldn't find much in the way of examples or documentation for

(Rubyful Soup is a HTML parser that is tolerant of incorrect markup, so
can work with HTML that WWW::Mechanize chokes on. Lyndon Samson mentioned
an alternative called Tidy, which transforms invalid HTML into something
more parsable.)

| Dan: My ultimate goal is to create a series of screen scrapers that are
| able to access airline websites (including entering username and
| password, dealing with redirects, etc.), find my mileage and recent
| flights, parse the data, put it in some variables, and save it to MySQL
| (with rails).

Dan did find one example using WWW::Mechanize, but his modification of it
didn't work. Michel Martens pointed out his error, and Dan was then able
to run the example successfully.

Ternary operator request

Robert Mannl asked for feedback on the idea of adding a ternary operator
expression in cases of methods ending in a question mark, in order to

some_method? a : b

instead of:

some_method? ? a : b

Although Alex Fenton called it a "cute idea", he and others were of one
mind to say that it would be extremely difficult to parse, both for Ruby
and for humans. David A. Black summed it up nicely:

| I also think the two ?'s in question, though both ?'s, are really
| semantically quite distinct.


| There's always `if' :)

Ara T. Howard then showed how something similar (but not identical) could
be achieved, using traits:

harp:~ > cat a.rb
require 'traits'

trait 'foo' => true

puts( foo ? 'foo' : 'not foo' )
puts( foo? ? 'foo' : 'not foo' )

foo false

puts( foo ? 'foo' : 'not foo' )
puts( foo? ? 'foo' : 'not foo' )

harp:~ > ruby a.rb
not foo
not foo

The trick is that both foo and foo? are defined.

New Releases


Yuichi Yoshida wrote a new Ruby interpreter, in Haskell.

gabriele renzi: "this is really cool, thanks for sharing it. But I wonder
why did you choose to write a ruby interpreter in Haskell?"

| Yuichi: The strange feature of Haskell absorbed me, especially lazy
| evaluation did. What a good sound, lazy! ;-)
| I wanted to write somthing and learn more about Haskell, and Ruby
| interpreter is a good theme to satisfy my desire.

RedCloth 3.0.4 -- Humane Text for Ruby

whytheluckystiff polish'ed humane markup parser RedCloth.

"Lists that were throwing exceptions are gone. Escaping of stray angle
brackets. Single- and double-quote directional wrongness is made aright."

World's 1st Hamster-Powered Mud Server! (in Ruby)

Jon A. Lambert announced the "World's 1st Hamster-Powered Mud Server! (in
Ruby)". Presumably, until now Hamster-Powered Mud Servers had been written
in other languages.

Read the announcement to see why Nick Faiz described it as "the best
software release announcement email I've ever read!"

gmailer 0.1.0

Park Heesob's gmailer library can fetch emails, use file attachments, get
contact lists, invite people, edit labels, preferences, star and archive

The API is slightly more high-level now, with methods returning objects of
classes like Conversation and Contact instead of hashes.

Zero to Rails

Ryan Davis: "From absolutely nothing to a running rails app in under two
minutes. SQL not required."

All due to "one part OmniGraffle 4, one part applescript, one part ruby,
and a dash of animosity towards SQL". (OmniGraffle is a diagramming tool
for MacOS X.)

"Awesome, disarming, astonishing!" tittered Piergiuliano Bossi.

Pimki 1.8.092

Assaph Mehr fixed bugs in Pimki, "The Wiki-based PIM to GetThingsDone".


Ara.T.Howard released the second version of acgi, "a drop-in replacement
for ruby's built-in cgi", but with persistence, speed and "no apache
modules" (unlike fastcgi).

Benchmarks with Apache showed that acgi was around five times faster than
plain CGI, but FastCGI was a further three times faster.

Dan Janowski: "My applause to you on trying to replace FastCGI. I gave up
on it after inexplicable weirdness began to set in."

He also gave some ideas for improving acgi's performance.

ritex 0.1: WebTeX -> MathML

William Morgan happily announced the first version of ritex, a tool for
converting WebTeX into MathML.

"WebTeX is an adaptation of TeX math syntax for web display", while MathML
is the standard, low-level and verbose, way of representing maths symbols
on the web.

| Ritex is based heavily on itex2mml, a popular TeX math to MathML
| convertor-so much so that the default correct answer to unit tests is to
| do whatever itex2mml does!

Unlike itex2mml, ritex is written in Ruby and supports macros.

KirbyRecord 0.0.0

Logan Capaldo: I am proud(?) to announce the first actual release of
KirbyRecord. KirbyRecord is an ORM layer for the very cool pure ruby
database, KirbyBase.

eric3 3.7.2 released

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Latest member

Latest Threads