Skip to content
CAI
Software that uses CAICheck a score

bokmann/business_time

59.0

Adequate · 6 November 2026

637

lines of production code

Ruby

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Ruby gem that extends Date, Time, and ActiveSupport::TimeWithZone classes to perform calculations based on business rules, such as workdays, holidays, and custom work hours. It provides methods for determining business day/hour increments, checking weekday status, and calculating consecutive business or non-business days. The library supports flexible configuration via thread-local settings, per-call holiday overrides, and YAML-based initialization, with generators available for Rails integration.

Features

Add Rails generator for Business Time configuration

A new Rails generator has been added that allows users to automatically create and install the default Business Time configuration files. Running the generator produces a \business\_time.rb\ initializer and a \business\_time.yml\ configuration file in the standard Rails directories, streamlining the setup process for the library.

lib/generators · high confidence

Add Rails generator for business time configuration

A new Rails generator has been added to scaffold business time configuration files. Running the generator creates a \config/initializers/business\_time.rb\ file that loads settings from a YAML file, and a \config/business\_time.yml\ file containing default values for work hours (9:00 am to 5:00 pm), holidays, and the work week (Monday through Friday). This allows users to easily customize business hours and holidays via a central YAML configuration file.

_rails\generators · high confidence

Added development convenience scripts for interactive console and environment setup

New executable scripts have been added to the bin directory to streamline local development. The bin/console script provides an interactive Ruby IRB environment pre-loaded with the gem's dependencies (including business\_time), allowing developers to experiment with the codebase easily. The bin/setup script automates the initial environment configuration by running bundle install to ensure all required gems are present.

bin · high confidence

Core extensions for Date, Integer, and Time classes added

This change introduces new core extensions for Ruby's Date, Integer, and Time classes to support business time calculations. The Date class now includes methods for determining workdays, weekdays, and fiscal date metrics (such as fiscal year, quarter, and week). The Integer class gains methods like \business\_hours\ and \business\_days\ to facilitate relative time arithmetic (e.g., \5.business\_hours.from\_now\). The Time class is extended with workday/weekday concepts and class methods. These extensions form the foundation for the library's business logic, enabling users to perform date and time calculations based on business rules.

_lib/business\_time/core\ext · high confidence

Behavioural changes

Business time methods now available on TimeWithZone objects

ActiveSupport::TimeWithZone instances now support business time calculations (such as weekday checks and workday computations) by including the same extensions previously available only on standard Time objects. This ensures consistent behavior for business logic regardless of whether a datetime is stored as a Time or a TimeWithZone.

_lib/business\_time/core\_ext/active\support · high confidence

BusinessTime 0.13.0: Thread-safe config, per-call holidays, and ActiveSupport-compatible date math

This release introduces thread-local configuration support via a new \Config.with\ block, allowing temporary overrides of work hours and holidays without affecting other threads. It also adds the ability to pass a \holidays\ array directly to methods like \workday?\, \business\_days\, and \business\_hours\, enabling per-call holiday definitions that override the static global config. The API now mirrors ActiveSupport's interface with \since\/\ago\ aliases for \after\/\before\ on \BusinessDays\ and \BusinessHours\, and includes new instance methods \weekday?\ and \workday?\ on \Time\. Additionally, the gem now supports configuring per-day work hours via \Config.work\_hours\ and provides \consecutive\_workdays\ and \consecutive\_non\_working\_days\ for calculating streaks of business or non-business days.

_lib/business\time · high confidence

Library initialization and core extension loading

The main library entry point now explicitly requires the core extension files for Integer, Date, Time, and ActiveSupport::TimeWithZone, ensuring these modules are loaded when business\_time is included. This change also adds dependencies on the 'set', 'time', and 'yaml' standard libraries, and loads the configuration, business hours, and business days modules, establishing the foundational structure for the library's time calculation capabilities.

lib · high confidence

Project maintenance and documentation updates

This change introduces several non-functional updates to the project infrastructure and documentation. A new \.gitmessage\ file is added to standardize commit message formatting for contributors. The \README\ has been converted from RDoc to Markdown format, and a \CHANGELOG.md\ file has been added to track version history according to the Keep a Changelog standard. The \CODE\_OF\_CONDUCT.md\ file is introduced, adopting the Contributor Covenant. Additionally, the \Rakefile\ has been refactored to remove the Jeweler gem dependency in favor of Bundler and standard Rake tasks, and the \.gitignore\ has been updated to exclude common local configuration files like \.ruby-version\ and \gemfile.lock\.

(repo-wide) · high confidence

Test coverage

Added comprehensive test suite for business day and hour calculations

Added a new test suite covering business day and business hour calculations for Time and Date objects, including support for standard, Eastern, and UTC time zones. The tests verify correct handling of positive and negative business day/hour increments, weekend rollovers, holiday exclusions (both global and per-call), and custom work hour configurations.

test · high confidence

Dependencies

Expanded Active Support version compatibility

The gemfiles have been updated to support testing against Active Support versions 3 through 8. This includes adding new gemfiles for Active Support 4, 5, 6, 7, and 8, while also ensuring compatibility with Active Support 3 by locking the tzinfo gem to version 1.2. For Active Support 6, the concurrent-ruby gem is constrained to versions less than 1.3.5.

gemfiles · high confidence

Initial gemspec and Gemfile setup for business\_time

The project now includes a Gemfile and a gemspec file to define its structure and dependencies. The gemspec specifies 'business\_time' as the package name, requires RubyGems as the source, and declares runtime dependencies on 'activesupport' (version 3.2.0 or higher) and 'tzinfo'. It also lists development dependencies including 'rake', 'rdoc', 'minitest', and 'minitest-reporters'.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 59 → 59 (-0.1)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 76 → 76 (+0.0)
  • Architecture 69 → 69 (+0.0)
  • Maturity 43 → 43 (+0.0)
  • Readiness 74 → 74 (+0.0)
  • Security 97 → 95 (-2.1)

Resolved (3)

  • Ambiguous naming for similar temporal operations. 'previous_business_day' implies moving back one day, while 'first_business_day' is ambiguous (first of the week? first available after a date?). If 'first_business_day' means 'next business day', it conflicts with the semantic of 'previous'. If it means 'start of week', it is domain-specific but poorly named compared to standard 'beginning_of_week'.
  • Generic 'roll' verbs are less descriptive than specific directional verbs like 'next' or 'previous'. While distinct, they are less intuitive than the explicit 'previous_business_day' and 'next_business_day' pattern used elsewhere.
  • Redundant methods with nearly identical signatures. 'business_days_until' likely returns an integer count, while 'business_dates_until' likely returns an array of dates. However, the naming is confusing because 'days' is often used colloquially for the count, but 'dates' is plural. The distinction is return type, not intent, but the names are too similar.

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

bokmann/business_time was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 0a9f42141e03a2599f9b7155a29df4c89f1bf97c — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.