README.md in nobiru-0.0.1 vs README.md in nobiru-1.0.0

- old
+ new

@@ -1,13 +1,12 @@ # Nobiru [![Gem Version](https://badge.fury.io/rb/nobiru.svg)](http://badge.fury.io/rb/nobiru) [![Build Status](https://travis-ci.org/drexed/nobiru.svg?branch=master)](https://travis-ci.org/drexed/nobiru) [![Coverage Status](https://coveralls.io/repos/drexed/nobiru/badge.png)](https://coveralls.io/r/drexed/nobiru) -[![Code Climate](https://codeclimate.com/github/drexed/nobiru.png)](https://codeclimate.com/github/drexed/nobiru) -Nobiru is a collection of commonly used object helpers in a ruby based project. It currently includes extensions for: arrays, enumerables, hashes, numerics, objects, strings, and time. +Nobiru (japanese: extend) is a collection of commonly used object helpers in a ruby based project. It currently includes extensions for: arrays, enumerables, hashes, numerics, objects, strings, and time. `Rails Safe` = methods extracted from rails but that do not override that rails method. Highly recommended extensions: * **Hash:** Hashie - https://github.com/intridea/hashie @@ -55,10 +54,27 @@ ["1", "2", "3"].remove_last #=> ["1", "2"] ``` ### EnumerableExtensions +####Difference:#### +Use the `difference` method to return the difference of a collection of numbers. + +```ruby +[1,2,3].difference #=> -4 +[].difference #=> 0 +[].difference(nil) #=> nil +``` + +Use the `divisible` method to return the division of a collection of numbers. + +```ruby +[16,4,2].divisible #=> 2 +[].divisible #=> 0 +[].divisible(nil) #=> nil +``` + ####Drop Last:#### Use the `drop_last` method to drops the last number of elements of a collection. ```ruby [1,2,3].drop_last(1) #=> [1,2] @@ -80,10 +96,18 @@ [1,2,3].excatly?(3) #=> true [1,1,3,3].exactly?(2, &:even?) #=> false [].exactly?(1) #=> false ``` +Use the `exponential` method to return the exponential of a collection of numbers. + +```ruby +[2,3,4].exponential #=> 4096 +[].exponential #=> 0 +[].exponential(nil) #=> nil +``` + ####Frequencies:#### Use the `frequencies` method to return a hash of the number of times a value in an array appears. ```ruby [1, :symbol, 'string', 3, :symbol, 1].frequencies #=> { 1 => 2, :symbol => 2, 'string' => 1, 3 => 1 } @@ -128,16 +152,24 @@ ####Mode:#### Use the `mode` method to return the most frequent value of a collection of numbers. ```ruby -[1,1,2,46].mode #=> 1 +[1,1,2,6].mode #=> 1 [1,2,3].mode #=> nil [].mode #=> 0 [].mode(nil) #=> nil ``` +Use the `multiple` method to return the multiplication of a collection of numbers. + +```ruby +[1,2,3].multiple #=> 6 +[].multiple #=> 0 +[].multiple(nil) #=> nil +``` + ####Range:#### Use the `range` method to return the difference between the smallest and largest value of a collection of numbers. ```ruby [1,2,6].range #=> 5 @@ -161,15 +193,14 @@ [1,2,6].standard_deviation #=> 2.6457513110645907 [].standard_deviation #=> nil ``` ####Sum:#### -Use the `sum` method to to return the sum of a collection of numbers. +Use the `sum` method to return the sum of a collection of numbers. ```ruby -[1,2,3].sum #=> 2 -[1,2,3,4].sum #=> 2.5 +[1,2,3].sum #=> 6 [].sum #=> 0 [].sum(nil) #=> nil ``` ####Take Last:#### @@ -289,10 +320,31 @@ "example".try(:fake_method) #=> nil ``` ### NumericExtensions +####Add:#### +Use the `add` method to add two numbers. + +```ruby +4.add(2) #=> 6 +``` + +####Divide:#### +Use the `divide` method to divide two numbers. + +```ruby +4.divide(2) #=> 2 +``` + +####Multiply:#### +Use the `multiply` method to multiply two numbers. + +```ruby +4.multiply(2) #=> 8 +``` + ####Multiple Of:#### Use the `multiple_of?` method to check if a number is the multiple of another. `Rails Safe` ```ruby 9.multiple_of?(3) #=> true @@ -311,9 +363,23 @@ Use the `positive?` method to check if a number is positive. ```ruby 1.positive? #=> true -1.positive? #=> false +``` + +####Power:#### +Use the `power` method to return the power of two numbers. + +```ruby +4.power(2) #=> 16 +``` + +####Subtract:#### +Use the `subtract` method to subtract two numbers. + +```ruby +4.subtract(2) #=> 2 ``` ####To Byte:#### Use the `to_byte` method to convert a byte size from one unit to another unit. \ No newline at end of file