OSU::Term

A simple utility gem for converting Ohio State's strms into human readable names, comparing strms to each other, and calculating the next strm.

To experiment with the code, run bin/console for an interactive prompt.

Installation

Add this line to your application's Gemfile:

gem 'osu_term'

And then execute:

$ bundle

Or install it yourself as:

$ gem install osu_term

Usage

term = OSU::Term.new(strm: '1152')
term.year # => 2015
term.name # => "Spring"
term.to_s # => "Spring 2015"
term.quarter? # => false
term.semester? # => true
term.next_strm # => '1154'
term.next #=> #<OSU::Term @strm="1154">

term < term.next # => true

The strm you pass in must be a string 4 digits in length.

  • The 1st digit must be a 0 or a 1. This represents the century of the term. 0 = 1900, 1 = 2000.
  • The next two characters represent the last two digits of the year.
  • If the strm is a quarter, the last digit must be 0 (Winter), 2 (Spring), 4 (Summer), or 8 (Autumn)
  • If the strm is a semester, the last digit must be 2 (Spring), 4 (Summer), or 8 (Autumn)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://code.osu.edu/asctech/osu_term. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the OsuTerm project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.