Skip to main content

Katachi

A Ruby tool for describing objects as intuitively as possible


# Step 1: Load the gem
require 'katachi'
Kt = Katachi
# Step 2: Describe the shape in plain Ruby
shape = {
:$uuid => {
email: :$email,
first_name: String,
last_name: String,
dob: Kt::AnyOf[Date, nil],
admin_only: Kt::AnyOf[
{Symbol => String},
:$undefined
],
Symbol => Object,
},
}
# Step 3: Check if you got a match
Kt.compare(value: api_response.body, shape:).match?