Project

linesman

0.0
No commit activity in last 3 years
No release in over 3 years
Linesman is a simple module that helps one determine if a value is within a given set of bounds.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
 Project Readme

Linesman

Determine if a value is in-bounds

Gem Setup

gem install linesman

# Gemfile
gem 'linesman'

How Do I Use This Thing?

There's not really much to it. There is only one method: Linesman.within_bounds?

It takes an option hash and a block.

The options hash must contain at least one of the following:

  • :exactly
  • :min
  • :max

The block should return a value that is comparable to the bounds specified in the options hash.

The method returns either true or false based on the given criteria.

Examples:

Linesman.within_bounds?(exactly: 1) {2 - 1} # => true

Linesman.within_bounds?(min: 1, max: 10) {1} # => true
Linesman.within_bounds?(min: 1) {0} # => false
Linesman.within_bounds?(max: 1) {0} # => true

Formal Documentation

The actual library docs can be read over on rubydoc.

Contributing

Do you use git-flow? I sure do. Please base anything you do off of the develop branch.

  1. Fork it.
  2. Perform some BDD magic. Seriously. Be testing.
  3. Submit a pull request.

So, Uh, Why?

In short, I've been needing this exact functionality all over the place of late, and it was quick enough to just throw it together.

License

MIT License. Copyright 2013 Ess