class Proc

Public Instance Methods

change?() { || ... } click to toggle source

TODO: Put in facets? TODO: wrong place, change yield?

# File lib/ae/core_ext/helpers.rb, line 162
def change?
  pre_result = yield
  called = call
  post_result = yield
  pre_result != post_result
end
raises?(exception=Exception, *args) click to toggle source
# File lib/ae/core_ext/helpers.rb, line 138
def raises?(exception=Exception, *args)
  begin
    call(*args)
    false
  rescue exception => error
    exception === error
  end
end
throws?(sym, *args) click to toggle source
# File lib/ae/core_ext/helpers.rb, line 148
def throws?(sym, *args)
  catch(sym) do
    begin
      call(*args)
    rescue ArgumentError  # 1.9 exception
    rescue NameError      # 1.8 exception
    end
    return false
  end
  return true
end