public
Fork of caring/acts_as_url_param
Description: Pretty url support for Ruby on Rails applications
Homepage: http://www.caring.com
Clone URL: git://github.com/joshuabates/acts_as_url_param.git
Search Repo:
acts_as_url_param / lib / metaid.rb
100644 15 lines (13 sloc) 0.398 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Object
  # The hidden singleton lurks behind everyone
  def metaclass; class << self; self; end; end
  def meta_eval &blk; metaclass.instance_eval &blk; end
 
  # Adds methods to a metaclass
  def meta_def name, &blk
    meta_eval { define_method name, &blk }
  end
 
  # Defines an instance method within a class
  def class_def name, &blk
    class_eval { define_method name, &blk }
  end
end