BasicSupport
add some usefull methods to core class for rails project
Installation
Add this line to your application's Gemfile:
gem 'basic_support'
And then execute:
$ bundle
Or install it yourself as:
$ gem install basic_support
Usage
1.to_b # => true
1.to_b # => false
true.to_i # => 1
false.to_i # => 0
"123".is_integer? # => true
"123ad".is_integer? # => false
"one more something".max_words(2, "..") # => "one more.."
"some".to_a # => ["some"]
1.to_a # => [1]
[ ["k1", "v1"], ["k2", "v2"] ].map_to_hash{|item| {item.first => item.last} } # => {"k1" => "v1", "k2" => "b2"}
[1,2,3,4].halved # => [ [1, 2], [3, 4] ]
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