Class: Object
- Inherits:
- BasicObject
- Defined in:
- ext/metaid.rb
Overview
The well know file made by why (redhanded.hobix.com/inspect/seeingMetaclassesClearly.html)
Instance Method Summary collapse
-
#class_def(name, &blk) ⇒ Object
Defines an instance method within a class.
-
#meta_def(name, &blk) ⇒ Object
Adds methods to a metaclass.
- #meta_eval(&blk) ⇒ Object
-
#metaclass ⇒ Object
The hidden singleton lurks behind everyone.
Instance Method Details
#class_def(name, &blk) ⇒ Object
Defines an instance method within a class
15 16 17 |
# File 'ext/metaid.rb', line 15 def class_def name, &blk class_eval { define_method name, &blk } end |
#meta_def(name, &blk) ⇒ Object
Adds methods to a metaclass
10 11 12 |
# File 'ext/metaid.rb', line 10 def name, &blk { define_method name, &blk } end |
#meta_eval(&blk) ⇒ Object
5 6 7 |
# File 'ext/metaid.rb', line 5 def &blk .instance_eval(&blk) end |
#metaclass ⇒ Object
The hidden singleton lurks behind everyone
4 |
# File 'ext/metaid.rb', line 4 def ; class << self; self; end; end |