Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/ronin/extensions/meta/object.rb
Overview
metaprogramming assistant -- metaid.rb
Instance Method Summary collapse
-
#class_def(name, &blk) ⇒ Object
Defines an instance method within a class.
-
#meta_def(name, &blk) ⇒ Object
Adds methods to a metaclass.
- #meta_eval(&blk) ⇒ Object
-
#metaclass ⇒ Object
The hidden singleton lurks behind everyone.
-
#metaclass_def(name, &blk) ⇒ Object
A class_def version of meta_def.
-
#metaclass_eval(&blk) ⇒ Object
A class_eval version of meta_eval.
Instance Method Details
#class_def(name, &blk) ⇒ Object
Defines an instance method within a class
21 22 23 |
# File 'lib/ronin/extensions/meta/object.rb', line 21 def class_def(name, &blk) class_eval { define_method(name, &blk) } end |
#meta_def(name, &blk) ⇒ Object
Adds methods to a metaclass
16 17 18 |
# File 'lib/ronin/extensions/meta/object.rb', line 16 def (name, &blk) { define_method(name, &blk) } end |
#meta_eval(&blk) ⇒ Object
5 |
# File 'lib/ronin/extensions/meta/object.rb', line 5 def (&blk); .instance_eval(&blk); end |
#metaclass ⇒ Object
The hidden singleton lurks behind everyone
4 |
# File 'lib/ronin/extensions/meta/object.rb', line 4 def ; class << self; self; end; end |
#metaclass_def(name, &blk) ⇒ Object
A class_def version of meta_def
11 12 13 |
# File 'lib/ronin/extensions/meta/object.rb', line 11 def (name, &blk) { define_method(name, &blk) } end |
#metaclass_eval(&blk) ⇒ Object
A class_eval version of meta_eval
8 |
# File 'lib/ronin/extensions/meta/object.rb', line 8 def (&blk); .class_eval(&blk); end |