domingo, 2 de octubre de 2011

Fastruby 0.0.11 released with support for retry, redo and foreach

Fastruby is a gem which allows to execute ruby code much faster than normal, currently in a state of transition between a spike and a usable gem, it is released when possible with incremental improvements.
The v0.0.11 release of fastruby make internal improvements regarding non-local jumps and implements foreach support, including retry and redo statements (both applicable to any kind of block, and retry applicable on rescue clause)

Install

You can clone the repository at github:
git clone git://github.com/tario/fastruby.git
git checkout v0.0.11
Or install it using gem install:
gem install fastruby

New Features


Examples of code being supported

For each with redo and retry

  1. require "fastruby"  
  2.   
  3. fastruby '  
  4. class X  
  5.  def foo  
  6.    sum = 0  
  7.   
  8.    for i in (4..8)  
  9.      p i # 4 4 4 4 4 5 6 7 4 5 6 7 4 5 6 7 4 5 6 7 8  
  10.      sum = sum +  i  
  11.      redo if sum < 20  
  12.      retry if sum < 100 and i == 7  
  13.    end  
  14.   
  15.    sum  
  16.  end  
  17. end  
  18. '  
  19.   
  20. x = X.new  
  21. x.foo # 46  


No hay comentarios:

Publicar un comentario