Hello,
Why does it call send with a block which yields instead of just
passing the block to send directly (like it used to)?
# new way
def method_missing(method, *args)
if load_target
if block_given?
@target.send(method, *args) { |*block_args|
yield(*block_args) }
else
@target.send(method, *args)
end
end
end
# old way
def method_missing(method, *args)
if load_target
@target.send(method, *args, &block)
end
end
This change messes up my implementation of full? which used to allow
me to do stuff like this:
puts self
=> #<Something:0x20e2c3c>
post.author.full?{ puts self } # self inside that block will be that
post's author.
=> #<Author:0xc3c2e02>
Now it's like this...
puts self
=> #<Something:0x20e2c3c>
post.author.full?{ puts self } # self inside that block will be that
post's author.
=> #< Something:0x20e2c3c>
I'm just curious why the change... and wondering if there is a way to
make it compatible with my full? implementation so I won't have to go
refactor tons of code.
Thanks for the help,
-- Christopher
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---