left_pad
Ruby implementation of famous npm package.
Installation
Add following line to your Gemfile:
gem 'left_pad'
And then execute:
$ bundle
Or install it system-wide:
$ gem install left_pad
Usage
Simple as that:
require 'left_pad'
'foo'.leftpad(5)
# => " foo"
'foobar'.leftpad(6)
# => "foobar"
String(1).leftpad(2, 0)
# => "01"
Contributing
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
P.S.
Don't take it seriously. It's just a joke ;)