module FatCore

## FatCore Date Extensions

The FatCore extensions to the Date class add the notion of several additional calendar periods besides years, months, and weeks to those provided for in the Date class and the active_support extensions to Date. In particular, there are several additional calendar subdivisions (called “chunks” in this documentation) supported by FatCore's extension to the Date class:

For each of those chunks, there are methods for finding the beginning and end of the chunk, for advancing or retreating a Date by the chunk, and for testing whether a Date is at the beginning or end of each of the chunk.

FatCore's Date extension defines a few convenience formatting methods, such as Date#iso and Date#org for formatting Dates as ISO strings and as Emacs org-mode inactive timestamps respectively. It also has a few utility methods for determining the date of Easter, the number of days in any given month, and the Date of the nth workday in a given month (say the third Thursday in October, 2014).

The Date extension defines a couple of class methods for parsing strings into Dates, especially Date.parse_spec, which allows Dates to be specified in a lazy way, either absolutely or relative to the computer's clock.

Finally FatCore's Date extensions provide thorough methods for determining if a Date is a United States federal holiday or workday based on US law, including executive orders. It does the same for the New York Stock Exchange, based on the rules of the New York Stock Exchange, including dates on which the NYSE was closed for special reasons, such as the 9-11 attacks in 2001.

The FatCore extensions to Hash provide a handful of generally useful methods on Ruby Hash objects.

You can get these with:

“` require 'fat_core/hash' “`

It provides a couple of methods for manipulating the keys of a Hash: `#remap_keys` for translating the current set of keys to a new set provided by a Hash of old to new keys, and `#replace_keys` for doing a similar operation with an Array of new keys. Along the same line, the method `#keys_with_value` will return the keys in a Hash equal to the given value of any of an Array of values.

It also provides a method for deleting all entries in a Hash whose value match a single value or any one of an Array of values in `#delete_with_value`

Finally, it provides an `#each_pair`-like method, `#each_pair_with_flags`, that yields each key-value pair of the Hash along with two boolean flags that indicate whether the element is the first or last in the Hash.

FatCore extends the Range class with methods that

  1. provide some set operations operations on Ranges, union, intersection, and difference,

  2. test for overlapping and contiguity between Ranges,

  3. test for whether one Range is a subset or superset of another,

  4. join contiguous Ranges,

  5. find whether a set of Ranges spans a large range, and if not, to return a set of Ranges that represent gaps in the coverage or overlaps in coverage,

  6. provide a definition for sorting Ranges based on sorting by the min values and sizes of the Ranges.

Constants

MAJOR
MINOR
PATCH
VERSION

FatCore version number