MotionAssert

Asserting in RubyMotion is a tricky task. NSAssert is not yet supported and displaying stacktrace or disabling asserts in release build are far from straight forward. The goal of this gem is to provide the best thing we can currently do for asserting within RubyMotion.

Installation

Add this line to your application's Gemfile:

gem 'motion-assert', :git => 'git://github.com/codiumco/motion-assert.git'

And then execute:

$ bundle

Or install it yourself as:

$ gem install motion-assert

Usage

Inlcude MotionAssert module in your app_delegate.rb:

include MotionAssert

Once MotionAssert module is included, you can assert by calling:

Debug.assert(someValue == otherValue, 'someValue is not equal to otherValue!')

Currently, displaying a stacktrace when an assert is raised is not yet supported. So when an assert is raised, the best way to identify where it come from is to supply a descriptive message. You can use ruby's __FILE__ and __LINE__ to help you identify the location of the assert as well.

WARNING!

Currently, automatically remove assert in release build is not yet support. Make sure you remember to perform a find-replace for 'Debug.assert' with '#Debug.assert' before you release your application

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request