Project

vangogh

0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby Gem for abstracting numbers
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
~> 10.0
>= 0

Runtime

>= 0
>= 0
 Project Readme

Vangogh

A Ruby Gem for abstracting numbers

Usage

# Abstract numbers
Vangogh.abstract 1234
=> 1200

Vangogh.abstract 12345
=> 12000

# Abstract and abbreviate
Vangogh.abbreviate 1234
=> "1.2k"

Vangogh.abbreviate 12345
=> "12.3k"

You can also extend the numbers themselves, if you prefer:

require 'vangogh/ext'

1234.abstract
=> 1200

12345.abbreviate
"12.3k"

Heck, you can even use it via command line:

$ vangogh abstract 1234
1200

$ vangogh abbreviate 12345
12.3k

Abstracting CSVs

Vangogh isn't just a single-medium artist. If you pass Vangogh the path to a CSV, it'll process all numeric-looking cells, and pipe the resulting CSV to STDOUT.

$ vangogh abstract csv.csv >> output.csv

If you want to explicitly include/exclude certain fields, you can do so with the fields argument.

$ vangogh abstract csv.csv --fields foo bar >> output.csv

Contributing

  1. Fork it ( https://github.com/benbalter/vangogh/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