Sha256: 936683c1c82a69ea541d25503deb4727e3f26d1be3d41339dfb76fead36b9665

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

= RubyVersionReader

Provides a +RubyVersionReader+ to simplify reading of +.ruby-version+ and +.ruby-gemset+ files in your programs.

== Setup

On your command-line:

    $ gem install ruby_version_reader

In Ruby:

    require 'ruby_version_reader'

== Usage

    # Initialize your reader
    reader = RubyVersionReader.new

    # The current base path where .ruby-version files are being looked for
    reader.path

    # Access .ruby-version and .ruby-gemset data
    reader.to_s #=> 'ruby-1.8.7-p249@rvr_gemset'
    reader.full_version #=> '1.8.7-p249'
    reader.gemset #=> 'rvr_gemset'

    # Check for the main version with a Float
    reader.is? 2.1

    # Use strings for exacter checking
    reader.is.above '1.9.2-p330'
    reader.is.at_least '2.0.0' # or exactly, below, at_most

    # You can use the common comparison operators
    reader >= '1.8.7'
    reader.between? '1.8.7', '1.9.2'

    # Misc Accessors
    reader.engine #=> 'ruby'
    reader.major # => 1
    reader.minor # => 8
    reader.tiny  # => 7
    reader.patchlevel # => 249

== Credit

Basic RubyVersionReader comparison logic from https://github.com/janlelis/ruby_version which originated from the zucker gem.

Copyright (c) 2014 Marcos Wright-Kuhns. MIT License.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_version_reader-0.2.0 README.rdoc
ruby_version_reader-0.1.1 README.rdoc
ruby_version_reader-0.1.0 README.rdoc