The Crystal Programming Language Forum

Introducing Berm

Hi! I made this little library to experiment with macros, it’s a little library that lets you manage permissions.

Any comment or review is really appreciated!


Whats the benefit over just using a Flags Enum?

enum MyFlags
  ReadWrite = Read | Write
pp       # => true
pp      # => false
pp  # => true
pp MyFlags::ReadWrite.write? # => true
pp MyFlags::None.write?      # => false
pp MyFlags::All.write?       # => true

(cross post from Reddit)

Actually none, I suppose. I’m new to Crystal, didn’t know about all the capabilities of flag enums and I wanted to experiment with macros. I build this object in python for work purposes and decided to reproduce in crystal, playing with ci and shards to learn something new ans I wanted to provide a really simple way to make an object for manage permissions. At lest this could be the base code where more useful features can be built upon