Class: Object

Inherits:
BasicObject
Defined in:
lib/ext/metaid.rb

Instance Method Summary collapse

Instance Method Details

#class_def(name, &blk) ⇒ Object

Defines an instance method within a class



12
13
14
# File 'lib/ext/metaid.rb', line 12

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

#meta_def(name, &blk) ⇒ Object

Adds methods to a metaclass



7
8
9
# File 'lib/ext/metaid.rb', line 7

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

#meta_eval(&blk) ⇒ Object



4
# File 'lib/ext/metaid.rb', line 4

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

#metaclassObject

The hidden singleton lurks behind everyone



3
# File 'lib/ext/metaid.rb', line 3

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