spec/unit/provider_spec.rb
# This is needed for Ruby 1.8.5, which throws an exception that the
# default rescue doesn't catch if the method isn't present.  Also, it has
# no convenient predicate for them, which equally hurts.
This is needed for Ruby 1.8.5, which throws an exception that the
default rescue doesn't catch if the method isn't present.  Also, it has
no convenient predicate for them, which equally hurts.
This is needed for Ruby 1 . 8 . 5 which throws an exception that the default rescue doesn ' t catch if the method isn ' t present . Also it has no convenient predicate for them which equally hurts .
def has_method?(object, name)
      begin
        return true if object.instance_method(name)
      rescue Exception
        return false
      end
    end
def has_method? ( object , name ) begin return true if object . instance_method ( name ) rescue Exception return false end end
This is needed for Ruby 1.8.5, which throws an exception that the
default rescue doesn't catch if the method isn't present.
This is needed for Ruby 1 . 8 . 5 which throws an exception that the default rescue doesn ' t catch if the method isn ' t present .
object
<not_specific>
name
<not_specific>