The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Feeling at home in Ruby (if you're coming from C)

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Florian Frank

Posts: 48
Nickname: ffrank
Registered: Dec, 2005

Florian Frank is a humanoid life-form, living on the third planet of the solar system.
Feeling at home in Ruby (if you're coming from C) Posted: Aug 3, 2007 4:57 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Florian Frank.
Original Post: Feeling at home in Ruby (if you're coming from C)
Feed Title: The Rubylution: Tag Ruby
Feed URL: http://rubylution.ping.de/xml/rss/tag/ruby/feed.xml
Feed Description: Starts… Now.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Florian Frank
Latest Posts From The Rubylution: Tag Ruby

Advertisement
class Fixnum
  alias __oldref :'[]'

  def [](obj)
    if Fixnum === obj
      __oldref(obj)
    else
      obj[self]
    end
  end
end

if $0 == __FILE__
  2[0] # => 0
  2[1] # => 1
  a = [2,3,5,7,11]
  a[2] # => 5
  2[a] # => 5
end

Read: Feeling at home in Ruby (if you're coming from C)

Topic: Spring Rails Plugin 0.1 Previous Topic   Next Topic Topic: Ruby ActiveRecord and MySQL

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use