Class: Object

Inherits:
BasicObject
Defined in:
lib/ruby_ami/metaprogramming.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) meta_def(name, &block)



12
13
14
15
16
# File 'lib/ruby_ami/metaprogramming.rb', line 12

def meta_def(name, &block)
  meta_eval do
    define_method name, &block
  end
end

- (Object) meta_eval(&block)



8
9
10
# File 'lib/ruby_ami/metaprogramming.rb', line 8

def meta_eval(&block)
  metaclass.instance_eval &block
end

- (Object) metaclass



2
3
4
5
6
# File 'lib/ruby_ami/metaprogramming.rb', line 2

def metaclass
  class << self
    self
  end
end