Skip to content

maiha/rrr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RRR
===
A ruby library for Ruby programming with RR that allows method overload.


Methods
=======

This provides new 'cm' and 'im' class methods to Object class

* Object.cm(&block)
    adds class methods

* Object.im(&block)
    adds instance methods


Example
=======

  require 'rrr'

  class User < ActiveRecord::Base
    cm do
      by(numeric) {|id|   User.find(id) }
      by(string)  {|name| User.find_by_name(name) }
    end
  end

  User.by('x')  # => called User.find_by_name('x')
  User.by(1)    # => called User.find(1)
  User.by       # RR::Errors::DoubleNotFoundError


Copyright (c) 2009 maiha@wota.jp, released under the MIT license

About

Ruby programming with RR

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages