I have a rails app running and I am placing binding.pry within a method that is called a lot.  I want to stop on a specific string on symbol, but I cannot find the syntax.  Here is my code:
  def can?(resource, operation, options={})
    binding.pry
    credentials(options[:as]).each do |credential|
      can = credential.can?(resource, operation, options)
      return can unless can.nil?
    end
    nil
  end
I see in the docs about the break keyword, but I can't seem to make that work either.  Could someone please show me what the syntax is supposed to be?  
You can just add an if
def can?(resource, operation, options={})
  binding.pry if your_condition_is_met
  credentials(options[:as]).each do |credential|
    can = credential.can?(resource, operation, options)
    return can unless can.nil?
  end
  nil
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With