Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/sequel/metaprogramming.rb
Overview
why the lucky stiff’s helper for making metaclasses
Instance Method Summary collapse
-
#class_def(name, &blk) ⇒ Object
Defines an instance method within a class.
-
#inst_def(name, &blk) ⇒ Object
Defines an class 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.
Instance Method Details
#class_def(name, &blk) ⇒ Object
Defines an instance method within a class
26 27 28 |
# File 'lib/sequel/metaprogramming.rb', line 26 def class_def name, &blk class_eval { define_method name, &blk } end |
#inst_def(name, &blk) ⇒ Object
Defines an class method within a class
31 32 33 |
# File 'lib/sequel/metaprogramming.rb', line 31 def inst_def name, &blk define_method name, &blk end |
#meta_def(name, &blk) ⇒ Object
Adds methods to a metaclass
17 18 19 |
# File 'lib/sequel/metaprogramming.rb', line 17 def name, &blk { define_method name, &blk } end |
#meta_eval(&blk) ⇒ Object
14 |
# File 'lib/sequel/metaprogramming.rb', line 14 def &blk; .class_eval &blk; end |
#metaclass ⇒ Object
The hidden singleton lurks behind everyone
13 |
# File 'lib/sequel/metaprogramming.rb', line 13 def ; class << self; self; end; end |