|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I'm trying to debug a bit of code. I want to output all the parameters
passed to PGconn#exec each time it is called but still have the method function as it should. I tried this: class PGconn def exec(*args) puts "exec: #{args}" super *args end end But super ends up calling Kernel#exec, how can I refer to the version of exec before I added the puts enhancement? -- Posted via http://www.ruby-forum.com/. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Tue, Apr 1, 2008 at 3:02 PM, Oliver Saunders
<oliver.saunders@gmail.com> wrote: > I'm trying to debug a bit of code. I want to output all the parameters > passed to PGconn#exec each time it is called but still have the method > function as it should. > > > I tried this: > > > class PGconn + alias_method ld_exec, :exec> def exec(*args) > puts "exec: #{args}" - super *args + old_exec(*args) > end > end |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Oliver Saunders wrote:
> I'm trying to debug a bit of code. I want to output all the parameters > passed to PGconn#exec each time it is called but still have the method > function as it should. > > > I tried this: > > > class PGconn alias old_exec exec > def exec(*args) > puts "exec: #{args}" old_exec(*args) > end > end Regards, Michael |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
|
|
![]() |
| Outils de la discussion | |
|
|