Class: Object

Inherits:
BasicObject
Defined in:
lib/trinidad_scheduler_extension/extensions/object.rb

Overview

Metaid == a few simple metaclass helper (See whytheluckystiff.net/articles/seeingMetaclassesClearly.html.)

Instance Method Summary collapse

Instance Method Details

#meta_def(name, &blk) ⇒ Object

Adds methods to a metaclass



9
10
11
# File 'lib/trinidad_scheduler_extension/extensions/object.rb', line 9

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

#meta_eval(&blk) ⇒ Object



6
# File 'lib/trinidad_scheduler_extension/extensions/object.rb', line 6

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

#metaclassObject

The hidden singleton lurks behind everyone



5
# File 'lib/trinidad_scheduler_extension/extensions/object.rb', line 5

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