Module: Kernel
- Defined in:
- lib/fancy-p/kernel_ext.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fancy-p/kernel_ext.rb', line 4 def method_missing(method_name, *args, &block) super unless method_name.to_s =~ /^p.$/ char = method_name.to_s[1] self.class.define_method(method_name) do |*forwarded_args| delimiter = char * 100 p delimiter p(*forwarded_args) p delimiter end send(method_name, *args) end |