Divisible

I just published my first ruby gem on rubygems.org. It is a simple gem that is useful in case you need to find out if one number is divisible by another.

Usage

  9.divisible_by(3) # => true
  10.divisible_by(3) # => false
  12.divisible_by(3) # => true
  12.divisible_by(4) # => true
  15.divisible_by(4) # => false

Same can be done with

  Divisible.check(9, 3) # => true
  Divisible.check(10, 3) # => false
  Divisible.check(12, 3) # => true
  Divisible.check(12, 4) # => true
  Divisible.check(15, 4) # => false

Installation

  gem install divisible

For more info go to https://github.com/vlado/divisible

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>