Class: Object

Inherits:
BasicObject
Defined in:
lib/ramaze/snippets/metaid.rb

Overview

Instance Method Summary (collapse)

Instance Method Details

- (Object) class_def(name, &blk)

Defines an instance method within a class



14
15
16
# File 'lib/ramaze/snippets/metaid.rb', line 14

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

- (Object) meta_def(name, &blk)

Adds methods to a metaclass



9
10
11
# File 'lib/ramaze/snippets/metaid.rb', line 9

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

- (Object) meta_eval(&blk)



6
# File 'lib/ramaze/snippets/metaid.rb', line 6

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

- (Object) metaclass

The hidden singleton lurks behind everyone



5
# File 'lib/ramaze/snippets/metaid.rb', line 5

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