Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Auto‑registration works for classes under [lib/json_logic/operations/](./lib/j
## PR checklist

- [ ] Tests or examples included (when applicable).
- [ ] Compliance suite passes (see **[§ Compliance and tests](./README.md#compliance-and-tests)**).
- [ ] Compliance suite passes (see **[§ Compliance](./README.md#compliance)**).
- [ ] **[README](./README.md)** updated if user‑facing behavior changed.
- [ ] Version bumped in [Gem Version File](./lib/json_logic/version.rb).
- [ ] **[CHANGELOG](./CHANGELOG.md)** updated.
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![jsonlogic core][src-core]](https://jsonlogic.com/tests.json) [![jsonlogic community][src-community]](https://github.com/json-logic/compat-tables/tree/main/suites) [![compliance 100%](https://img.shields.io/badge/compliance-100%25-brightgreen)](https://github.com/tavrelkate/json-logic-rb/actions/workflows/compliance.yml?query=branch%3Amain) <a href="https://rubygems.org/gems/json-logic-rb"><img alt="rubygems" src="https://img.shields.io/gem/v/json-logic-rb"></a> <a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-informational"></a>
[![jsonlogic core][src-core]][core-tests] [![jsonlogic community][src-community]][community-suites] [![compliance 100%][badge-compliance]][ci-main] [![Build Status][badge-buildkite]][ci-main] [![rubygems][badge-rubygems]][rubygems] [![license][badge-license]][license]

# json-logic-rb

Expand All @@ -8,12 +8,12 @@ Ruby implementation of [JsonLogic](https://jsonlogic.com/). Pure and extensible.
- [What](#what)
- [Install](#install)
- [Quick start](#quick-start)
- [Complience](#complience)
- [Compliance](#compliance)
- [Supported Operations (Built-in)](#supported-operations-built-in)
- [Adding Operations](#adding-operations)
- [Enable JsonLogic Semantics (optional)](#enable-jsonlogic-semantics-optional)
- [Parameters](#parameters)
- [Proc / Lambda](#proc--lambda)
- [Proc and Lambda](#proc-and-lambda)
- [Class](#class)
- [Laziness](#laziness)
- [1. Default Operations](#1-default-operations)
Expand All @@ -24,7 +24,7 @@ Ruby implementation of [JsonLogic](https://jsonlogic.com/). Pure and extensible.
- [Truthiness](#truthiness)
- [Security](#security)
- [License](#license)
- [Authors](#authors)
- [Maintainers](#maintainers)

---

Expand Down Expand Up @@ -75,11 +75,11 @@ JsonLogic.apply(rule, data)



## Complience
## Compliance

The JsonLogic specification provides test suites — concrete inputs with expected outputs that validate the implementation of operations. The specification comes in two variants:
- [![jsonlogic core][src-core]](https://jsonlogic.com/tests.json) – [original JsonLogic website](https://jsonlogic.com/tests.json)
- [![jsonlogic community][src-community]](https://github.com/json-logic/compat-tables/tree/main/suites) – [extensions built on top of the core](https://github.com/json-logic/compat-tables/tree/main/suites)
- [![jsonlogic core][src-core]](https://jsonlogic.com) – [original JsonLogic website](https://jsonlogic.com/tests.json)
- [![jsonlogic community][src-community]](https://github.com/json-logic) – [extensions built on top of the core](https://github.com/json-logic/compat-tables/tree/main/suites)

The "extra" exists because "core" hasn't changed in years — and that’s fine, "core" is a solid, finished foundation. Think of it as v1, while "extra" is the v2+ evolution as there are no visible plans to change the original.

Expand Down Expand Up @@ -144,13 +144,22 @@ The JsonLogic specification provides test suites — concrete inputs with expect

[src-core]: https://img.shields.io/badge/jsonlogic-core-2ea44f?style=flat-square
[src-community]: https://img.shields.io/badge/jsonlogic--community-extra-0366d6?style=flat-square
[badge-compliance]: https://img.shields.io/badge/compliance-100%25-brightgreen
[badge-buildkite]: https://img.shields.io/github/actions/workflow/status/tavrelkate/json-logic-rb/compliance.yml?branch=main&label=build
[badge-rubygems]: https://img.shields.io/gem/v/json-logic-rb
[badge-license]: https://img.shields.io/badge/license-MIT-informational
[core-tests]: https://jsonlogic.com
[community-suites]: https://github.com/json-logic
[ci-main]: https://github.com/tavrelkate/json-logic-rb/actions/workflows/compliance.yml?query=branch%3Amain
[rubygems]: https://rubygems.org/gems/json-logic-rb
[license]: LICENSE


## Adding Operations

Don’t expect JsonLogic to include every specialized operation. It’s intentionally small and not a programming language. It will never do everything.

Before you reach for a custom solution, see if you can express your logic using the [§Supported Operations (Built‑in)](https://www.google.com/search?q=%23supported-operations-built-in). Often, a simple change in perspective is all you need to get the job done with what's already there.
Before you reach for a custom solution, see if you can express your logic using the [§Supported Operations (Built-in)](#supported-operations-built-in). Often, a simple change in perspective is all you need to get the job done with what's already there.

If that doesn't cut it, adding a custom operation is straightforward. Keep it simple: start with a Proc or a Lambda. If needed – promote it to a Class.

Expand All @@ -172,7 +181,7 @@ Operator function use a consistent call shape:
->((string, prefix), data) { string.to_s.start_with?(prefix.to_s) }
```

### Proc / Lambda
### Proc and Lambda

Pick the Operation type.

Expand Down
Binary file removed json-logic-rb-0.2.0.beta.gem
Binary file not shown.
4 changes: 2 additions & 2 deletions json-logic-rb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Gem::Specification.new do |s|
s.license = "MIT"
s.required_ruby_version = ">= 3.0"

s.homepage = "https://github.com/tavrelkate/json-logic-rb"
s.homepage = "https://jsonlogic.com"
s.metadata = {
"homepage_uri" => "https://github.com/tavrelkate/json-logic-rb",
"homepage_uri" => "https://jsonlogic.com",
"source_code_uri" => "https://github.com/tavrelkate/json-logic-rb",
"documentation_uri" => "https://github.com/tavrelkate/json-logic-rb",
"changelog_uri" => "https://github.com/tavrelkate/json-logic-rb/blob/main/CHANGELOG.md"
Expand Down
2 changes: 1 addition & 1 deletion lib/json_logic/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

module JsonLogic; VERSION = '0.2.0.beta1'; end
module JsonLogic; VERSION = '0.2.0'; end