Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/johnjansen/clamp

Clamp for Comparable in Crystal-Lang
https://github.com/johnjansen/clamp

Last synced: about 1 month ago
JSON representation

Clamp for Comparable in Crystal-Lang

Awesome Lists containing this project

README

        

# clamp

[![GitHub version](https://badge.fury.io/gh/johnjansen%2Fclamp.svg)](http://badge.fury.io/gh/johnjansen%2Fclamp)
[![CI](https://travis-ci.org/johnjansen/clamp.svg?branch=master)](https://travis-ci.org/johnjansen/clamp)

implements `#clamp` on any `Comparable`

```
'a'.clamp('b', 'c') # => 'b'
'b'.clamp('a', 'c') # => 'b'
'd'.clamp('a', 'c') # => 'c'

...
```

## Installation

Add this to your application's `shard.yml`:

```yaml
dependencies:
clamp:
github: johnjansen/clamp
```

## Usage

```crystal
require "clamp"
```

## Contributing

1. Fork it ( https://github.com/johnjansen/clamp/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request

## Contributors

- [johnjansen](https://github.com/johnjansen) John Jansen - creator, maintainer