# Ruby Weekly News 6th - 12th February 2006

**URL:** <https://www.ruby-forum.com/t/ruby-weekly-news-6th-12th-february-2006/68538>\
**Category:** Ruby\
**Created:** [February 15, 2006, 10:49am UTC](https://www.ruby-forum.com/t/ruby-weekly-news-6th-12th-february-2006/68538 "2006-02-15T10:49:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [February 15, 2006, 10:49am UTC](https://www.ruby-forum.com/t/ruby-weekly-news-6th-12th-february-2006/68538/1 "2006-02-15T10:49:54Z")

</div>

[http://www.rubyweeklynews.org/20060212.html](http://www.rubyweeklynews.org/20060212.html)

# Ruby Weekly News 6th - 12th February 2006

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

[Contribute to the next newsletter]

# User Group News

```
 * OK.rb's First Meeting
 -----------------------

   James Edward G. II announced the first meeting of the Oklahoma 

```

Ruby  
Users Group: March 14th 2006 at the University of Central  
Oklahoma.

```
   | This first meeting is being organized by myself and Grant 

```

Schofield  
| and we will be providing some educational content to get us  
going. I  
| will give a “Uniquely Ruby” talk, focusing on those things that  
make  
| Ruby stand out from other languages. Grant is giving a  
first-look at  
| Rails presentation as well. Both talks will be aimed at Ruby  
| programmers of all skill levels.

```
 * Boulder-Denver Ruby Group - February 15th
 -------------------------------------------

   Marty H. said that the Boulder-Denver Ruby Group are holding 

```

their  
February meeting on Wednesday 15th.

```
   "David A. Black will be joining our group that night and will be
   presenting for our group."

 * February Ruby events in the SF Bay Area
 -----------------------------------------

   Rich M. posted a list of Ruby events in the San Francisco Bay 

```

Area  
during February.

```
   The SF Ruby Meetup is on the 21st, and the Beer & Scripting SIG 

```

is on  
the 22nd.

# Quote of the Week

```
 * Ruby's lisp features.
 -----------------------

```

> Let’s call it MatzLisp from now on. 😉
> 
> ```
> matz.
> 
> ```

# Threads

## FasterGenerator (#66)

James Edward G. II came up with this week’s Ruby Q…

> ```
> end
> 
> ```

Ruby’s standard Generator class was recently re-written to improve  
performance. Your mission is to make it even faster.

Matz: “I’d be happy to replace current implementation of generator.rb  
with  
the winning one.”

Some very promising benchmarks were posted.

## Getting last character from a string

draco draco asked for a nice way of getting the last character in a  
String.

Several people said that you can use negative indices to count  
backwards  
from the end of String and Array objects, for example -1 for the end,  
-2  
for the second-to-last etc.

Based off a post by Gennady B.,

s = “abc”  
s[-1] # 99  
s[-1].chr # “c”

## Adding properties to a method?

jonT wanted to know how to add `properties’ to Method objects.

##### 

class Method  
attr\_accessor :foo  
end

def bar  
“some\_res”  
end

method(:bar).foo = 1

puts(method(:bar).foo) # =\> nil instead of 1

##### 

The problem is that method(:bar) returns a new Method instance each  
time  
it is called.

As is often the case, the Facets project has a solution. It includes  
method!, which returns the same Method instance each time it’s given  
the  
same method name.

(Not so good if some code redefines the method in between two calls  
to  
method! though.)

## Ruby port for Nokia 770 Wireless Internet Tablet

Ken Hilton successfully ported Ruby 1.8.4 to the “Nokia 770 Wireless  
Internet Tablet” (which runs Linux).

“Before porting Ruby to it, it was love at first sight. Now I’m  
ecstatic.”

He will be posting a tarball once he’s setup a rubyforge account.

## how to do instance\_eval with arguments

Jim W.: “I’m prototyping a DSL and came across a situtation  
where I  
have a lambda that I would like to give to instance\_eval, but the  
lambda  
takes arguments. Instance\_eval will not supply any arguments when  
evaluating the lambda and I don’t see a straightforward way around  
this.”

Matz said that Ruby in CVS HEAD has instance\_exec for this.

See also [Frost-safe DSL’ing with instance\_exec] by Mauricio  
Fernandez,  
which gives a safe implementation of instance\_exec for Ruby 1.8.

The above article was found via Christian N.'s [Anarchaia].  
Chris also questioned why a new method was added, rather than just  
making  
instance\_eval pass any arguments it receives.

For those readers who are confused about why you would ever need this  
feature (as was I initially), note that it is never needed in the  
usual  
case when the block passed in is defined on the spot.

# Not useful

value = 42  
obj.instance\_exec(value) { |v| some\_method(v) }

# Lexical scoping means we could just write

value = 42  
obj.instance\_eval { some\_method(value) }

Consider the case, though, where a block taking arguments has been  
defined  
somewhere else, and we now want to instance\_eval it.

# This doesn’t achieve anything. blk isn’t evaluated against obj.

value = 42  
obj.instance\_eval { blk.call(value) }

# This works

value = 42  
obj.instance\_exec(value, &blk)

# New Releases

A few of the highlights this week …

## Watir WebRecorder for Ruby

Marcus Tettmar announced Watir WebRecorder, "a version of WebRecorder  
that  
creates Ruby/Watir code. Watir WebRecorder is a multi-tabbed web  
browser  
that records web activity in Internet Explorer and creates Ruby code  
which  
uses the Watir library for IE automation.

WebRecorder is designed to speed up the creation of web testing and  
web  
automation scripts."

## Nitro + Og 0.28.0: Cacheable, Ruby Query Language, Mongrel, Og cloning

George M. released new versions of Nitro and Og, a web  
application framework and object-relational mapper respectively.

Caching and querying were improved, bugs fixed, plus a bunch of other  
new  
features.

## Spreadsheet::ParseExcel

Hannes W. announced a pure-Ruby library for reading Excel files. It  
is  
based off the Perl module of the same name.
