Sha256: 002d53e11abbf653cc445b04df6091bc5b0c99cad4bd80ba99a1ad37628ac31c
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
# CreativeRailsUtilities Defines extensions, useful and convenient methods on Ruby and Rails base classes. ## Installation `gem 'creative_rails_utilities'` and `bundle` ## Usage Feel free to read the source under `/lib/creative_rails_utilities/` ##### Date ```ruby # get an array of date objects Date.build_date_array("2015-10-11", "2015-10-13") #=> ["2015-10-11".to_date, "2015-10-12".to_date "2015-10-13".to_date] ``` ```ruby # get an array of dates between one date object and another "2015-10-11".to_date.build_date_array("2015-10-09") #=> ["2015-10-09".to_date, "2015-10-10".to_date, "2015-10-11".to_date] ``` ##### Hash ```ruby # fast sort by key some_hash.fast_sort_keys #=> some_sorted_hash ``` ```ruby # ensure a hash has a range of integer keys (useful for graphs) {}.populate_with_keys(min: 1, max: 3) #=> {1 => 0, 2 => 0, 3 => 0} ``` ##### Numeric ```ruby # integer into letters 1.to_s26 #=> "a" 28.to_s26 #=> "ab" ``` ```ruby # delete with zero 1.safe_percent(2) #=> 200 0.safe_percent(0) #=> 0 ``` ##### String ```ruby # letters into integer "z".to_i26 #=> 26 "apple".to_i26 #=> 749325 ``` ## Development Use ruby >=2.2 1. Write specs 2. Make specs fail 3. Write feature 4. Make tests pass 5. Update README.md with examples 6. Update CHANGELOG.md with changes/fixes/additions. 7. Bump version and `rake release` ## Contributing Bug reports and pull requests are welcome on [GitHub](https://github.com/CreativePublisher/rails_utilities) ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
creative_rails_utilities-0.1.2 | README.md |