This is a gem containing an eclectic library of methods. Most of the methods are for scientific computing, but there is a helper for Rspec, extensions to the Date class, and methods for building ruby bash scripts.
Add this line to your application's Gemfile:
gem 'chris_lib', git: 'https://github.com/obromios/chris_lib.git'
or use
gem 'chris_lib'
And then execute:
$ bundle
YARD annotations are included throughout the gem. Generate HTML docs with:
bundle exec yard doc
open doc/index.htmlFor a live server:
bundle exec yard server --reload --server webrickThen browse to http://localhost:8808.
DateExtextendsDatewith helpers such as#charmians_formatfor Australian-style formatting and#us_format_with_weekdayfor full weekday strings.TestAccessships an RSpec macro (it_should_route_to) that keeps controller access tests terse.ChrisMathenriches Ruby core classes (Array,Float,Matrix,Quaternion, etc.) with linear algebra and statistics helpers.
ForChrisLib bundles the analytical helpers that previously lived in a different project. Include it whenever you need the extras:
require 'chris_lib'
include ForChrisLib
pdf_from_hist([3, 5, 2], min: -1)
# => {-1=>0.3, 0=>0.5, 1=>0.2}Highlights include:
ChiSquaredStdErrfor quick goodness-of-fit tests from means and standard errors.- Histogram tooling (
pdf_from_hist,summed_bins_histogram,bin_shift) for exploratory analysis. - Weighted statistics (
weighted_mean,weighted_sd,weighted_skewness). - Numerical integration helpers (
simpson,cdf_calc) and inverse-transform sampling utilities.
Some helpers depend on optional gems:
minimizationis used bybias_estimate_by_minunless you inject a custom minimiser.
Ruby 3.4 treats many standard libraries (base64, bigdecimal, logger, mutex_m, ostruct, date) as default gems. If you see warnings about them not being loaded, add the corresponding gems to your Gemfile or run gem pristine <name> inside your Ruby 3.4.2 gemset.
The chris_lib gem is supported by The Golf Mentor.
There is no need to contribute, but in case you feel you have to...
- Fork it ( https://github.com/[my-github-username]/chris_lib/fork )
- 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 a new Pull Request