Hi, this blog is no longer maintained, my new blog is here

Ruby On Rails and a Conning Israeli entrepreneur

Add custom operators in Ruby

Jay Phillips developed the 'superators' gem, which enables the use of custom operators in Ruby. for example.

  1. require 'rubygems'  
  2. require 'superators'  
  3.   
  4. class Array  
  5.   superator "<---" do |operand|  
  6.     self << operand.reverse  
  7.   end  
  8. end  
  9.   
  10. ["jay"] <--- "spillihp"  

0 comments:


The Web Ask eizesus.com

Subscribe

    follow me on Twitter

    Twiters Around

    About Me

    My photo
    I am a web developer for more than 9 years, managed, cried, coded, designed and made money in this industry. now trying to do it again.

    Labels