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

method_missing always gets a block #3469

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

Comments

Projects
None yet
1 participant
@Asmod4n
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 in 736be0e Feb 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment