Module: Metaid

Included in:
ClassBaker, Wizarding
Defined in:
lib/bats/modules/metaid.rb

Overview

Sorry _why I don’t feel like extending Ruby’s Object class.

Instance Method Summary collapse

Instance Method Details

#class_def(n, &b) ⇒ Object



13
14
15
# File 'lib/bats/modules/metaid.rb', line 13

def class_def( n, &b )
  class_eval { define_method( n, &b ) }
end

#meta_def(n, &b) ⇒ Object



9
10
11
# File 'lib/bats/modules/metaid.rb', line 9

def meta_def( n, &b )
  meta_eval { define_method( n, &b ) }
end

#meta_eval(&b) ⇒ Object



5
6
7
# File 'lib/bats/modules/metaid.rb', line 5

def meta_eval &b
  metaclass.instance_eval &b
end

#metaclassObject



3
# File 'lib/bats/modules/metaid.rb', line 3

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