Class: Object

Inherits:
BasicObject
Defined in:
lib/mylibs.rb

Overview

meta programming support methods.

ref. http://http://dannytatom.github.com/metaid/

Instance Method Summary collapse

Instance Method Details

#class_def(name, &blk) ⇒ Object

Defines an instance method within a class



488
489
490
# File 'lib/mylibs.rb', line 488

def class_def name, &blk
    class_eval { define_method name, &blk }
end

#meta_def(name, &blk) ⇒ Object

Adds methods to a metaclass



483
484
485
# File 'lib/mylibs.rb', line 483

def meta_def name, &blk
    meta_eval { define_method name, &blk }
end

#meta_eval(&blk) ⇒ Object



480
# File 'lib/mylibs.rb', line 480

def meta_eval &blk; metaclass.instance_eval &blk; end

#metaclassObject

The hidden singleton lurks behind everyone



479
# File 'lib/mylibs.rb', line 479

def metaclass; class << self; self; end; end