inactive-support
Version, currently 0.4.13 versions
- 0.4.1latestJul 17, 2026
- 0.4.0not indexedJul 17, 2026
- 0.1.1not indexedJul 17, 2026
github.com/spider-gazelle/inactive-support
Utilities for crystal-lang
10 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
inactive-support:
github: spider-gazelle/inactive-support
version: ~> 0.4.1Then run:
shards installshard.yml
- Crystal
>= 0.36.0- License
- MIT
- Author
- Kim Burgess <kim@place.technology>
Dependencies
This version declares no dependencies.
README
# Inactive Support
[](https://github.com/spider-gazelle/inactive-support/actions/workflows/crystal.yml)
[](https://spider-gazelle.github.io/inactive-support)
A collection of classes, modules, macros and standard library extensions to simplify common tasks in crystal-lang.
Each tool is small, independent and generic.
To use a tool, explicitly `require` where needed.
```crystal
require "inactive_support/<tool name>"
```
Their usage should be highly intentional and not a default choice.
## Tools
### `args`
Enables `args` to be stated anywhere within a method body.
This is substituted with a NamedTuple containing the arguments of the surrounding method.
```crystal
def example(a : String, b : String, c : String)
args
end
example "foo", "bar", "baz" # => {a: "foo", b: "bar", c: "baz"}
```
### `collection`
The `Collection` module provides an interface and tools for working with any collection type.
This includes both index and key-based containers.
When required it will extend all compatible types with the std lib.
To use with domain types
```
include Collection(KeyOrIndexType, ValueType)
```
It provides standardised access to elements and the ability to lazily traverse nested structures.
```crystal
nested = {
a: 42,
b: [:foo, :bar, :baz],
c: {"hello" => "world"},
}
nested.traverse.to_h # =>
# {
# {:a} => 42,
# {:b, 0} => :foo,
# {:b, 1} => :bar,
# {:b, 2} => :baz,
# {:c, "hello"} => "world",
# }
```
### `mapped_enum`
Provides support for defining non-integer enum types.
```crystal
mapped_enum Example do
A = "foo"
B = "bar"
C = "baz"
end
```
Members may be accessed via a compile-time lookup from their mapped value
```crystal
Example["foo"] # => Example::A
```
Attempting static resolution for an unmapped value will result in a compile error
```crystal
Example["qux"]
Error: No mapping defined from "qux" to Example
```
Instances may be read dynamically
```crystal
Example.from_mapped_value "foo" # => Example::A
```
Mapped values may also be extracted
```crystal
Example::A.mapped_value # => "foo"
```
All other functionality and safety that enums provide holds.
### `presence`
Provides `Object#presence`.
This Allows one to check for the presence of useful data in container types such as `Array` and `Hash`.
```crystal
# hash loaded from config file or database
# imagine this is `Hash(String, String) | Nil`
my_hash = {} of String => String
# set some defaults
my_hash = my_hash.presence || {"default" => "settings"}
```
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.4.1- Tagged
- Jul 17, 2026
- Commit
f6913d9345f8- Crystal
>= 0.36.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/spider-gazelle/inactive-support
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 3