ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Fund Crystal's development: | GH: | Docs: | Gitter:
_ht has joined #crystal-lang
Sankalp- has joined #crystal-lang
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp- is now known as Sankalp
<FromGitter> <> yup i have used it for some smaller production things. it works ok but agree it has a bunch of rough corners. ⏎ ORMs are sadly hard and i think it's just one guy working on it. and not many alternatives on crystal, yet (there's also but i've found that even rougher).
jmdaemon has quit [Ping timeout: 268 seconds]
<FromGitter> <> hmm, i'm confused.
<FromGitter> <> i thought crystal doesn't do aarch64 on linux, yet? 🤔
<FromGitter> <> otoh, there's also this:
* FromGitter * scratches head
<FromGitter> <> ohhh. 84codes has docker images for arm64, yay
Sankalp has quit [Ping timeout: 255 seconds]
Sankalp has joined #crystal-lang
<FromGitter> <> terror of my girlcock_20221227085627.jpg (
<FromGitter> <Blacksmoke16> Packt is currently running a promotion from 13th December to 17th January where all eBooks are only $5 when purchased via Packt’s website. This would be a perfect time to pickup a copy of the "Crystal Programming" book if anyone hasn’t already done so! ⏎ ⏎
<FromGitter> <> @Blacksmoke16: what do i put in front of athena validator to validate strings? it seems to expect input values in the right type (e.g. GreaterThan won't work on a string).
<FromGitter> <Blacksmoke16> like the length of the string?
<FromGitter> <> no, i have "3" and want to validate with GreaterThan
<FromGitter> <Blacksmoke16> `"3.".to_i`
<FromGitter> <> yea can crystal do that for me or should i look elsewhere? :P
<FromGitter> <> s/crystal/athena/
<FromGitter> <Blacksmoke16> where does the value come from?
<FromGitter> <> ARGV
<FromGitter> <> it's always a string, just looking for a cast & validate
<FromGitter> <> or parse & validate rather
<FromGitter> <> i assume athena does sth like that for request params, but dunno if it's pluggable for standalone use
<FromGitter> <Blacksmoke16> iirc its just like `` or whatever numeric type you want
<FromGitter> <Blacksmoke16> which calls the related `to_*` method on it
<FromGitter> <Blacksmoke16>
<FromGitter> <Blacksmoke16> so depending on context could just always treat it as a float or Int64 then pass that thru
<FromGitter> <> yea nah, i don't know what it is - that's what i want the validator to tell me, whether it's a valid int ;)
<FromGitter> <> just still looking for excuses to use athena here - but every time i bump into something :(
<FromGitter> <Blacksmoke16> oh
<FromGitter> <Blacksmoke16> could just use with the regex from his lib :P
<FromGitter> <> pfft :P
<FromGitter> <Blacksmoke16> prob be the easiest way ` /^([-+]?[0-9]*\.?[0-9]*)$/` and tada
<FromGitter> <> that's not the only validation i want, duh. if i'm gonna write all that stuff myself i don't need a shard
<FromGitter> <> so i'll give some love to niche shards and use his - maybe next time athena, one day you'll be in my shard.yml :P
<FromGitter> <Blacksmoke16> yea but then you could easily pair it with like to get a single constraint to use for your needs. Also could leverage if so desired
<FromGitter> <> yea athena has some cool stuff and looks clean and is well maintained, that's why i thought about it first
<FromGitter> <Blacksmoke16> ❤️
<FromGitter> <> but for this case i don't need all that fancy stuff. i just need it to look at a string and tell me if it's value meets some constraint (and interpret it accordingly if it's a numeric constraint)
<FromGitter> <Blacksmoke16> if thats all you want to do prob dont even need a shard in that case
<FromGitter> <Blacksmoke16> `abort "Input must be an integer" unless ARGV[1].matches? /number_regex/`
<FromGitter> <> the validations are user configurable. so some abstraction is needed. like... well, i have a shard now :)
<FromGitter> <Blacksmoke16> boo :p
<FromGitter> <> i tried ¯\_(ツ)_/¯
_ht has quit [Remote host closed the connection]
hightower2 has quit [Ping timeout: 264 seconds]
jmdaemon has joined #crystal-lang