Sha256: ebb3834f2c3d6c30a308e9f09769dad5769e0fad79ebe570257cbd7fe393162c

Contents?: true

Size: 421 Bytes

Versions: 1

Compression:

Stored size: 421 Bytes

Contents

=begin rdoc

= Init

Allows you to use #init inplace of #initialize. It does this by
aliasing initialize to init when it is defined.

== Synopsis

  require 'carat/init'
  
  class T
    def init
      puts "Here"
    end
  end
  
  t = T.new   #=> "Here"

== Author(s)

* Thaoms Sawyer

=end

class Class
  def method_added( meth )
    if meth == :init
      self.class_eval { alias initialize init }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carats-0.3.0 lib/carat/init.rb