Skip to content

method_missing always gets a block #3469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Asmod4n opened this issue Feb 26, 2017 · 0 comments
Closed

method_missing always gets a block #3469

Asmod4n opened this issue Feb 26, 2017 · 0 comments

Comments

@Asmod4n
Copy link
Contributor

Asmod4n commented Feb 26, 2017

When method_missing gets triggered it always gets a block, even when not passed.

class MissingError
  def method_missing(method, *args, &block)
    if block_given?
      puts "block_given?"
    end
    if block
      puts "block"
    end
  end
end

missing_error = MissingError.new
missing_error.hello

Expected result would be nothing, but both assume a block gets passed.

@matz matz closed this as completed in 736be0e Feb 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant