berm
Version, currently 0.2.02 versions
- 0.2.0latestOct 13, 2020
- 0.1.0not indexedOct 13, 2020
github.com/giuseongit/berm
Simple library that helps to manage permissions.
Installation
# Add this to your shard.yml
dependencies:
berm:
github: giuseongit/berm
version: ~> 0.2.0Then run:
shards installshard.yml
- Crystal
0.34.0- License
- MIT
- Author
- Giuseppe Pagano
- Target
bermfrom src/berm.cr
Dependencies
Development Dependencies
- ameba~> 0.12.0github: crystal-ameba/amebadev
README
Berm

Berm is a simple library that helps to manage permissions.
The name come from binary permmissions because it can easily manage permissions using byte operations.
Rationale
bit operations are quite simple (and thus fast), and it's sometimes useful to have permission system that can be used programmatically, think about showing or hiding certain ui features based on the context. So the goal of this tool is to have a good permission system with the least hoverhead as possbile while being easy to use.
Usage
The class Berm::Flag represent the permission manager.
It needs to know which flags it will have so you can use the Berm::FlagsConstant("Myvar") annotation or declaring the FlagValues variable. Only string and symbol array are supported.
require "berm"
class MyFlag < Berm::Flag
FlagValues = %i(Read Write)
# Foreach flag value (aka permission) a constant is generated
# Flags can be combined using the or operator
ReadWrite = Write | Read
end
# For every permission a method `permits_{permission}?` is generated
puts MyFlag::Read.permits_read? # -> true
puts MyFlag::Read.permits_read? # -> false
puts MyFlag::ReadWrite.permits_read? # -> true
puts MyFlag::ReadWrite.permits_write? # -> true
# Also a None constant is generated to match the state of no permissions at all
# The permits_something? tells wheter there's at least one permission enabled
# it can be called on every permission
puts MyFlag::None.permits_something? # -> false
This is the basic usage, you can find more usage examples in examples.
Contributing
- Fork it (https://github.com/your-github-user/berm/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Giuseppe Pagano - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.2.0- Tagged
- Oct 13, 2020
- Commit
a4dd2eb7eb47- Crystal
0.34.0- Indexed
- yes
Dependents
Repository
github.com/giuseongit/berm
Metadata
- Created
- Aug 18, 2026
- Updated
- Oct 22, 2026
- Synced
- Oct 22, 2026
- Versions
- 2