Sha256: 3c2e3c48810cb2ff28ab68dde3e6998070cf43eed0d8d99c6e85570da010d730

Contents?: true

Size: 236 Bytes

Versions: 13

Compression:

Stored size: 236 Bytes

Contents

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

13 entries across 13 versions & 1 rubygems

Version Path
ruby_ami-1.2.3 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.2.2 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.2.1 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.2.0 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.1.2 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.1.1 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.0.1 lib/ruby_ami/metaprogramming.rb
ruby_ami-1.0.0 lib/ruby_ami/metaprogramming.rb
ruby_ami-0.1.5 lib/ruby_ami/metaprogramming.rb
ruby_ami-0.1.4 lib/ruby_ami/metaprogramming.rb
ruby_ami-0.1.3 lib/ruby_ami/metaprogramming.rb
ruby_ami-0.1.2 lib/ruby_ami/metaprogramming.rb
ruby_ami-0.1.1 lib/ruby_ami/metaprogramming.rb