debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
Guest41 has joined #crystal-lang
Guest41 has quit [Client Quit]
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
postmodern has joined #crystal-lang
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
<postmodern>
what types of code are allowed inside of enums? I'm wanting to write an enum, but add a constant that maps Strings (file extension names) to the enum values and use that in a class-method that determins the enum value based on a path's file extension
<postmodern>
i get this error "invalid constant value" https://carc.in/#/r/cno9 on the "FILE_FORMATS = {" line
frojnd1 is now known as frojnd
<postmodern>
also how do people test code that relies on `ENV`?
<postmodern>
do you add an argument that defaults to `ENV` to allow passing in a custom mock `ENV` Hash in your specs?
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
<straight-shoota>
Yeah, enums can't have any constants other than members. You could use a class variable instead.
<straight-shoota>
You can mutate `ENV` in the setup step of a spec and later reset it
HumanG33k has quit [Ping timeout: 240 seconds]
taupiqueur has joined #crystal-lang
debayer948 has quit [Remote host closed the connection]
debayer948 has joined #crystal-lang
<postmodern>
straight-shoota, ah, i thought ENV was read-only?