Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/puppet/util/metaid.rb,
lib/puppet/util/monkey_patches.rb
Instance Method Summary collapse
-
#class_def(name, &blk) ⇒ Object
Defines an instance method within a class.
-
#daemonize ⇒ Object
ActiveSupport 2.3.x mixes in a dangerous method that can cause rspec to fork bomb and other strange things like that.
-
#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
18 19 20 |
# File 'lib/puppet/util/metaid.rb', line 18 def class_def(name, &blk) class_eval { define_method name, &blk } end |
#daemonize ⇒ Object
ActiveSupport 2.3.x mixes in a dangerous method that can cause rspec to fork bomb and other strange things like that.
28 29 30 |
# File 'lib/puppet/util/monkey_patches.rb', line 28 def daemonize raise NotImplementedError, "Kernel.daemonize is too dangerous, please don't try to use it." end |
#meta_def(name, &blk) ⇒ Object
Adds methods to a singleton_class
8 9 10 |
# File 'lib/puppet/util/metaid.rb', line 8 def (name, &blk) { define_method name, &blk } end |
#meta_eval(&blk) ⇒ Object
5 |
# File 'lib/puppet/util/metaid.rb', line 5 def (&blk); singleton_class.instance_eval(&blk); end |
#meta_undef(name, &blk) ⇒ Object
Remove singleton_class methods.
13 14 15 |
# File 'lib/puppet/util/metaid.rb', line 13 def (name, &blk) { remove_method name } end |
#singleton_class ⇒ Object
The hidden singleton lurks behind everyone
4 |
# File 'lib/puppet/util/metaid.rb', line 4 def singleton_class; class << self; self; end; end |