G
gabriele renzi
I just looked at matz' slides and I don't have a clear understanding
of ho9w this is suposed to work.
Possibly this has been explained verbosely, But I can't get it from
the slide.
So, this is the example:
class Foo
def foo(*args) #1
p 'foo'
end
def foore (*args ) #2
p 'pre'
end
def fooost (*args) #3
p 'post'
end
def foo:wrap (*args) #4
p 'wrap pre'
super
p 'wrap post'
end
end
now: what are pre post and wrap?
Are this just generic (casual) names for the wrapping functions? (so
we could have def foo:bar)
Are they wrapping idioms ?
if true
what do they are for? Do the work as in :
pre called before the method
post called after the method
wrap could call super and get the old method
I suppose pre and post are actually useless this way, cause they
can be emulated with foo:wrap()
or do the work as
pre wraps the original method
post wraps the latest wrapping of the method
wrap ... ?
someone would please explain this to me ?
of ho9w this is suposed to work.
Possibly this has been explained verbosely, But I can't get it from
the slide.
So, this is the example:
class Foo
def foo(*args) #1
p 'foo'
end
def foore (*args ) #2
p 'pre'
end
def fooost (*args) #3
p 'post'
end
def foo:wrap (*args) #4
p 'wrap pre'
super
p 'wrap post'
end
end
now: what are pre post and wrap?
Are this just generic (casual) names for the wrapping functions? (so
we could have def foo:bar)
Are they wrapping idioms ?
if true
what do they are for? Do the work as in :
pre called before the method
post called after the method
wrap could call super and get the old method
I suppose pre and post are actually useless this way, cause they
can be emulated with foo:wrap()
or do the work as
pre wraps the original method
post wraps the latest wrapping of the method
wrap ... ?
someone would please explain this to me ?