Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/puppet/util/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 singleton_class.
- #meta_eval(&blk) ⇒ Object
-
#meta_undef(name, &blk) ⇒ Object
Remove singleton_class methods.
-
#singleton_class ⇒ Object
The hidden singleton lurks behind everyone.
Instance Method Details
#class_def(name, &blk) ⇒ Object
Defines an instance method within a class
19 20 21 |
# File 'lib/puppet/util/metaid.rb', line 19 def class_def(name, &blk) class_eval { define_method name, &blk } end |
#meta_def(name, &blk) ⇒ Object
Adds methods to a singleton_class
9 10 11 |
# File 'lib/puppet/util/metaid.rb', line 9 def (name, &blk) { define_method name, &blk } end |
#meta_eval(&blk) ⇒ Object
6 |
# File 'lib/puppet/util/metaid.rb', line 6 def (&blk); singleton_class.instance_eval(&blk); end |
#meta_undef(name, &blk) ⇒ Object
Remove singleton_class methods.
14 15 16 |
# File 'lib/puppet/util/metaid.rb', line 14 def (name, &blk) { remove_method name } end |
#singleton_class ⇒ Object
The hidden singleton lurks behind everyone
5 |
# File 'lib/puppet/util/metaid.rb', line 5 def singleton_class; class << self; self; end; end |