Skip to content

Refactor: namespace all classes under Absmartly module#6

Merged
cwmpinho merged 4 commits into
refactor/namespace-absmartlyfrom
copilot/sub-pr-5
Feb 24, 2026
Merged

Refactor: namespace all classes under Absmartly module#6
cwmpinho merged 4 commits into
refactor/namespace-absmartlyfrom
copilot/sub-pr-5

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 20, 2026

All 55+ classes were defined at the top level (e.g., Client, Context, Unit), polluting the global Ruby namespace and causing collisions in consuming apps using autoloaders like Zeitwerk.

Changes

  • Moved all lib files from lib/ into lib/absmartly/, following standard gem layout convention (lib/<gem_name>/)
  • Wrapped all classes/modules in module Absmartlylib/json/lib/absmartly/json/, lib/json_expr/lib/absmartly/json_expr/
  • Preserved monkey-patches unwrapped: String#compare_to in string.rb and Array.wrap in expr_evaluator.rb stay outside module Absmartly
  • Updated entry point lib/absmartly.rb require paths from "client""absmartly/client", etc.
  • Updated json_expr/json_expr.rb operator requires from 'json_expr/operators/...''absmartly/json_expr/operators/...'
  • Updated all 30+ spec files to use Absmartly::ClassName references and updated require paths
  • Version bump 1.3.02.0.0 (breaking API change)

Before / After

# Before — top-level, collides with consuming app constants
client = Client.create(config)
ctx = Context.create(...)

# After — properly namespaced
client = Absmartly::Client.create(config)
ctx = Absmartly::Context.create(...)

The Absmartly module-level convenience methods (Absmartly.configure_client, Absmartly.create_context, etc.) are unchanged.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 20, 2026 13:02
- Move all lib/*.rb files into lib/absmartly/ directory
- Wrap all class/module definitions in module Absmartly
- Keep String and Array monkey-patches unwrapped
- Update lib/absmartly.rb to use new require paths
- Bump VERSION from 1.3.0 to 2.0.0
- Update all spec files to use Absmartly:: prefix and absmartly/ require paths
- Remove old lib/ files (moved to lib/absmartly/)
- All 261 tests pass

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…to 2.0.0

Co-authored-by: cwmpinho <154367772+cwmpinho@users.noreply.github.com>
Co-authored-by: cwmpinho <154367772+cwmpinho@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor to use Absmartly as top module Refactor: namespace all classes under Absmartly module Feb 20, 2026
Copilot AI requested a review from cwmpinho February 20, 2026 13:08
@cwmpinho cwmpinho marked this pull request as ready for review February 24, 2026 11:05
@cwmpinho cwmpinho merged commit 22f96eb into refactor/namespace-absmartly Feb 24, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants