Sha256: 812c6aab0d7e4dc9744816d1d752bef3b5d8a47b8356fe9035407f73d7f595ec

Contents?: true

Size: 254 Bytes

Versions: 8

Compression:

Stored size: 254 Bytes

Contents

# encoding: utf-8
class Object
  def metaclass
    class << self
      self
    end
  end

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruby_ami-1.3.4 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.3.3 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.3.2 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.3.1 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.3.0 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.2.6 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.2.5 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.2.4 lib/ruby_ami/metaprogramming.rb