RubyVersion <img src=“” />

Provides a RubyVersion to simplify checking for the right Ruby version in your programs.

Setup

On your command-line:

$ gem install ruby_version

In Ruby:

require 'ruby_version'

Usage

# return RUBY_VERSION
RubyVersion
# check for the main version with a Float
RubyVersion.is? 1.8
# use strings for exacter checking
RubyVersion.is.above '1.8.7'
RubyVersion.is.at_least '1.8.7' # or exactly, below, at_most
# you can use the common comparison operators
RubyVersion >= '1.8.7'
RubyVersion.between? '1.8.6', '1.8.7'
# relase date checks
RubyVersion.is.older_than Date.today
RubyVersion.is.newer_than '2009-08-19'
# accessors
RubyVersion.major # e.g. => 1
RubyVersion.minor # e.g. => 8
RubyVersion.tiny  # e.g. => 7
RubyVersion.patchlevel # e.g. => 249
RubyVersion.description # e.g. => "ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]"

J-_-L

Copyright © 2010-2014 Jan Lelis. MIT License. Originated from the zucker gem.