Skip to content

Commit

Permalink
Fix for macruby. Macruby doesn't pass the block to super by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdaniels committed May 3, 2011
1 parent 9f718c1 commit a43cc51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/mechanize/page.rb
Expand Up @@ -54,7 +54,9 @@ def initialize(uri=nil, response=nil, body=nil, code=nil, mech=nil)
end
end

super(uri, response, body, code)
super(uri, response, body, code) do |file|
yield file if block_given?
end
end

def title
Expand Down

3 comments on commit a43cc51

@cyberfox
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very cool; I just tried this out and it works...as a painfully irrelevant nitpick, your tab settings appear to be off, as you can see at:

super(uri, response, body, code) do |file|

Still, I just tested the hypothesis (both super failing to pass blocks, and this specific change to Mechanize) and it's definitely correct, and that's something major that MacRuby is going to have to fix.

@jamesdaniels
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I filed a ticket https://www.macruby.org/trac/ticket/1257

I was happy that I found the underlying problem, hacking parser.mech like I was reading in comments just felt dirty and was avoiding discovery of the fundamental difference between the environments. Took a lot of stack tracing ;)

@jamesdaniels
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is unnecessary as of MacRuby/MacRuby@d54db7e

Please sign in to comment.