<FromGitter>
<adamgotterer_twitter> I have a websocket server / client setup. I'm curious why the context on_close method (sent to HTTP::WebSocketHandler.new) can't detect a client disconnect? If the server hangs up my client knows the socket was closed. But it doesn't seem to work in the reverse. Any ideas how I can detect a client disconnect from the server?
wontruefree has quit [Read error: Connection reset by peer]
<FromGitter>
<faustinoaq> BTW, would be possible to use `h2o.cr` as `HTTP::Server` replacement for crystal frameworks like Kemal/Amber/Raze/Lucky?
<FromGitter>
<S-YOU> h2o run on its own eventloop, so it is kind of tricky with Fiber/Scheduler and GC
<FromGitter>
<faustinoaq> @S-YOU Thanks for the link! 👍
<FromGitter>
<faustinoaq> @S-YOU Oh, I see you disabled most crystal stdlib `-Dgc_none -D... -Dextreme` etc 😅
<FromGitter>
<S-YOU> True, it is basically C
<FromGitter>
<faustinoaq> Oh ok 😄 👍
<FromGitter>
<faustinoaq> Still very impressive ✨
<FromGitter>
<S-YOU> It is ok to turn on most of them, I just don't use any for C bindings.
<FromGitter>
<S-YOU> There is little overhead on bound checks with exception handling, GC is okay to include as long as you don't trigger it.
<FromGitter>
<S-YOU> Also it is very easy to see llvm-ir or assembly without them, because by default you get like 50k lines of LLVM-IR, but without them, it is like 500 lines.
<FromGitter>
<S-YOU> Yeah, but within hot loop, triggering GC is not a good choice. h2o has its own mempool, which never return to system but can reuse, if there is a need to allocate.
<FromGitter>
<faustinoaq> > Also it is very easy to see llvm-ir or assembly without them, because by default you get like 50k lines of LLVM-IR, but without them, it is like 500 lines, same level as C. ⏎ ⏎ Yeah, I saw your tweet, without stdlib, the LLVM-IR generated by crystal looks pretty clean 👍
<FromGitter>
<faustinoaq> @S-YOU Yeah 👍
<FromGitter>
<faustinoaq> Thank you for your collaboration with crystal community, very appreciated! 😄
<FromGitter>
<S-YOU> I am very happy to meet with them :)
<FromGitter>
<S-YOU> I met MakeNowJust in person too 😄 , showed as part of the crystal lexer, which I am trying to learn.
<FromGitter>
<codenoid> i was success to solve my problem
<FromGitter>
<codenoid> now how i can split 1 number into 3 number in array with random division
<crystal-gh>
[crystal] Daniel-Worrall opened pull request #6240: Fix HTTP::Server example in Playground About (master...bug-fix/playground-about) https://git.io/f87sO
<FromGitter>
<Daniel-Worrall> ah
<FromGitter>
<Daniel-Worrall> change it to splits - 1
<FromGitter>
<Daniel-Worrall> on the `n == splits `
<FromGitter>
<codenoid> done
<FromGitter>
<Daniel-Worrall> you know what, that doesn't work either
<FromGitter>
<Daniel-Worrall> I just have broken code and that's all there is to it
<crystal-gh>
[crystal] Daniel-Worrall closed pull request #6240: Fix HTTP::Server example in Playground About (master...bug-fix/playground-about) https://git.io/f87sO
Ven`` has joined #crystal-lang
<FromGitter>
<bew> what are you trying to do @Daniel-Worrall ?
<FromGitter>
<Daniel-Worrall> I was trying to assist codenoid
<FromGitter>
<Daniel-Worrall> > i have x : 200, how to split x into list of number (in array) with random division ⏎ ⏎ example: ⏎ ⏎ ```1. [2,5,3] # x : 10 ⏎ 2. [7,1,2] # x : 10 ⏎ 3. [8,5,7] # x : 20``` [https://gitter.im/crystal-lang/crystal?at=5b2c9e77aeb8fa0c073607f9]
<FromGitter>
<bew> ah ok, fun
Ven`` has quit [Read error: Connection reset by peer]
Ven` has joined #crystal-lang
Ven` has quit [Read error: Connection reset by peer]
<FromGitter>
<faustinoaq> is `ld-musl` statically or dynamically linked?
rohitpaulk has quit [Ping timeout: 260 seconds]
<crystal-gh>
[crystal] icyleaf opened pull request #6241: add .new and .empty? to HTTP::Params (master...feature-http-params) https://git.io/f4Kxx
<crystal-gh>
[crystal] icyleaf opened pull request #6242: Featues/raise exception use class and message (master...featues/raise-exception-use-class-and-message) https://git.io/f4PYt
That_Guy_Anon has joined #crystal-lang
rohitpaulk has joined #crystal-lang
Ven` has joined #crystal-lang
Ven`` has quit [Read error: Connection reset by peer]
<crystal-gh>
[crystal] icyleaf closed pull request #6242: Featues/raise exception use class and message (master...featues/raise-exception-use-class-and-message) https://git.io/f4PYt
DTZUZO has quit [Ping timeout: 276 seconds]
Raimondii has joined #crystal-lang
Raimondii is now known as Raimondi
Ven` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<rishavs> Generic question about JWT; Do i need to decrypt them on every single server call to get the userid and exp date? If yes, then isn't that going to add a whole lot to the server overhead?
<FromGitter>
<aisrael> Well, it's either that or you lookup the session token/user id from a central store (e.g. Redis), which is *definitely* a lot of overhead.
<FromGitter>
<S-YOU> we use to verify the header hash, not the payload
<FromGitter>
<S-YOU> dynamically linked but linked to none, would be my answer.
Raimondii has joined #crystal-lang
Ven`` has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
prutheus has joined #crystal-lang
<prutheus>
I have an array byte_90 = [false, 0] , now, i want to do byte_90[1] + 1 at some point in my code, but there the error comes: undefined method '+' for Bool (compile-time type is (Bool | Int32))
<prutheus>
how to solve that?
<That_Guy_Anon>
can you do a bool.to_i ? not sure if that is applicable. but basically since the values in the array can either be boolean or int you have to make ure that it is an int when using +
<That_Guy_Anon>
i think there is a function for checking if something is an int.
<prutheus>
but the compiler still errors on b[1] + 1
<prutheus>
`byte_90[1] + 1 if byte_90[1].is_a?(Number)` results in undefined method '+' for Bool (compile-time type is (Bool | Int32))
<That_Guy_Anon>
you gotta do an else
<FromGitter>
<aisrael> Have you tried `b[1].as(Int) + 1`?
<That_Guy_Anon>
so you can ise b[1].is_a?(Number) ? b[1] = b[1] +1 : (nothing here)
<That_Guy_Anon>
that might work aswell, but i am not sure if you can use as(int) on bool. i don'T know the language that well after all :D
<prutheus>
as int is the solution, thanks
<That_Guy_Anon>
nice to know that as(int) works on bool :D
<FromGitter>
<rishavs> > dynamically linked but linked to none, would be my answer. ⏎ @S-YOU can you elaborate a bit? I keep my userid and expiry in the payload. If I don't verify the payload, I can't make auth work
<FromGitter>
<aisrael> It doesn't quite "work" on `Bool`. It assumes the value is an `Int` and casts/treat it as such. If you try `b[0].as(Int)` it'll compile but you get a run-time exception
prutheus has quit [Quit: Page closed]
<That_Guy_Anon>
so is my solution better?
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 260 seconds]
gewo has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<bew> You can try `a.each_values.sum`
<FromGitter>
<bew> Hmm no, there is no `Iterator#sum`, you have to do `a.values.sum`
<FromGitter>
<bew> @vladfaust there is `@def`
<FromGitter>
<vladfaust> Thanks, @bew
<FromGitter>
<yxhuvud> I do wonder a bit why iterator doesn't have sum.
wuehlmaus has joined #crystal-lang
<FromGitter>
<codenoid> thankyou @bew
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
<FromGitter>
<faustinoaq> > dynamically linked but linked to none, would be my answer. ⏎ ⏎ @S-YOU Ok, thank you! 😄 👍
<FromGitter>
<S-YOU> @rishavs, ah, that comment about dynamic link is to faustinoaq's question regarding ld-musl.
<FromGitter>
<S-YOU> And yeah, user_id and expiry should be encrypted, so if they are in payload, I think there is not much choice without encrypting payload.
rohitpaulk has quit [Ping timeout: 276 seconds]
Ven`` has joined #crystal-lang
snsei has joined #crystal-lang
Ven`` has quit [Read error: Connection reset by peer]
Ven`` has joined #crystal-lang
<FromGitter>
<S-YOU> Thanks @laginha87, Nice post.
duane has joined #crystal-lang
Ven` has joined #crystal-lang
snsei has quit [Read error: Connection reset by peer]
snsei has joined #crystal-lang
Ven`` has quit [Ping timeout: 276 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter>
<asterite> Iterator includes Enumerable, so it trivially has sum
TCZ has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
That_Guy_Anon has quit [Ping timeout: 256 seconds]
rocx has joined #crystal-lang
<rocx>
is there a standard way to do a main()-like function in an app besides a `fun main(...)` ?
rohitpaulk has joined #crystal-lang
<rocx>
seems like putting much of anything into fun main without everything into the module will compile fine then segfault when the app is run.
<RX14>
why are you trying to do a main function?
<rocx>
standalone app.
<RX14>
what do you mean by that
<rocx>
i ran `crystal init app` to more or less get started on that and all the code really generates is a bit of boilerplate with the module.
<RX14>
you don't write a main function in crystal
<rocx>
it's all toplevel?
<RX14>
you just write code at the top level
<RX14>
yes
<RX14>
it'll segfault because you're overriding `main`, the main function is provided by the stdlib and it calls the top-level code and initializes constants etc
<rocx>
ah.
* rocx
did bad and looked at the crystal source for that.
<rocx>
alright think i'm getting the swing of it. thanks.
Ven` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has quit [Remote host closed the connection]
<FromGitter>
<n00ax> Was annoyed trying to cross-compile to arm64, so I built a set of shell scripts that run docker containers to automate the whole process (p.s, I'm no shell wizard so it's pretty bad... :) ) https://github.com/n00ax/crystal-arm-crosscompile
<FromGitter>
<sdogruyol> I'd really love to have a toolchain helper for Crystal, just like rustup
<FromGitter>
<j8r> and change the directory name from dppm-static to whatever, and run at the top level `./build-static x86-64, arm64`
<FromGitter>
<j8r> @n00ax Why have you simply not used Alpine:edge :)
rohitpaulk has joined #crystal-lang
<FromGitter>
<rvelez83> Hello Everyone, new to Crystal, for some time now I've been testing out various languages, I appreciate Crystal's best of both worlds nature. Started playing with it recently and wanted to share my first hiccup, building a static executable, is there a straightaway way of doing it?
<FromGitter>
<rvelez83> @j8r Thanks for the resource. Is there any info I can follow on how to make building static executables work on my system? I'd like to learn how to solve the issue myself.
<FromGitter>
<bcardiff> @vladfaust TypeNode has nilable?, but is a bit ugly to get the information of a union due to how the ast is parsed. but depending on your use case it might be enough to ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b2d091dce3b0f268d38a3a6]
<FromGitter>
<vladfaust> `undefined macro method 'Union#type_vars'` kek. Looks like this `Union` is different from your `Union`
<FromGitter>
<vladfaust> And no, I haven't got any monkey patches or namedspaced Unions
<FromGitter>
<vladfaust> But nevermind, I already got used to `{ |t| "#{t}" == "::Nil" }`
<crystal-gh>
[crystal] bcardiff opened pull request #6243: Spec: allow --link-flags to be used (master...feature/spec-link-flags) https://git.io/f4DNT
That_Guy_Anon has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter>
<j8r> @rvelez83 There isn't really a good reason to do it on your PC, unless you have time to spend. For dev, dynamically linked is enough. When you release a new version, you can compile it statically with optimization flags. ⏎ For static linking, you'll need `dev` packages wich must have `.a` archives bundled. If you are on macos, this isn't possible
<FromGitter>
<rvelez83> @j8r I'm on Linux. What I'd like to do is be able to build on one system binaries that I can have copied over to another(Linux as well) and run.
<FromGitter>
<HCLarsen> Yo folks, got a question about Macros. Is it possible to see the code generated by my Macro to ensure that I'm getting what I want?
<FromGitter>
<j8r> with `{% debug %}`you can see this
<FromGitter>
<j8r> you can put it anywhere in the code
<FromGitter>
<HCLarsen> So I put it anywhere in my code, and when it runs, I'll see the generated code?
<FromGitter>
<j8r> I think it have to be in the macro
<FromGitter>
<HCLarsen> Ahh, ok.
akaiiro has joined #crystal-lang
<FromGitter>
<HCLarsen> Works rather weird from inside a loop.
<FromGitter>
<rvelez83> @j8r Thanks a lot, I've successfully built my first Crystal static "Hello World" binary :)
<FromGitter>
<j8r> 🎉
akaiiro has quit [Ping timeout: 248 seconds]
<FromGitter>
<HCLarsen> Welcome to the Crystal family.
<FromGitter>
<rvelez83> @HCLarsen Thanks Mr. Larsen
<FromGitter>
<hmans> @laginha87 You know why it's &:foo in Ruby, right?
<FromGitter>
<vlazar> is there an easy way to run Crystal on Raspberry Pi yet?
<FromGitter>
<HCLarsen> I had to get Julien to update something, but he is on top of it.
<RX14>
yeah im sure they work
<RX14>
but they might install 0.23.5 or sth lol
<RX14>
oh
wontruefree has joined #crystal-lang
<FromGitter>
<vlazar> would running something instead of raspbian be a better idea?
<RX14>
no
<FromGitter>
<vlazar> :(
<RX14>
why are you said
<RX14>
there's a repo to use
<FromGitter>
<HCLarsen> As far as I know, that build only works on Raspbian.
<FromGitter>
<HCLarsen> damn.
<FromGitter>
<HCLarsen> We really need to get all the RaspPi people together, so we can work on that all together, instead of depending on Julien for everything.
<RX14>
PRs to generate armhf debs for the official tools would be welcome
<RX14>
then the debian instructions for officcial packages could work on reaspbian
pwned has joined #crystal-lang
akaiiro has joined #crystal-lang
<FromGitter>
<HCLarsen> That would be good.
rohitpaulk has joined #crystal-lang
akaiiro has quit [Remote host closed the connection]
<FromGitter>
<j8r> @vlazar if your raspberry pi is on ARM64, no problem
akaiiro has joined #crystal-lang
<FromGitter>
<j8r> this means => you are on RPi3 without Raspbian
<FromGitter>
<vlazar> will alpine work?
<FromGitter>
<j8r> You have multiple solutions here
<FromGitter>
<vlazar> I'm not a linux guy, anything that's easy enough would work for me, do you have any preferences?
<RX14>
why not use rasbian?
<RX14>
if raspbian works fine why not use it?
<FromGitter>
<vlazar> I'm fine with raspbian too as long as it has lates Crystal
<RX14>
then your best bet is using that repo
<RX14>
and then compiling latest crystal using that compiler
<RX14>
then pinging ysbaddaden
<FromGitter>
<vlazar> ok, thanks guys, will try
<RX14>
that is - if it's not up to date
<RX14>
compiling the latest crystal should be fairly easy
<RX14>
"should be"
<FromGitter>
<vlazar> :)
<FromGitter>
<vlazar> famous last words
<FromGitter>
<vlazar> btw, is Crystal 0.25.1 around the corner?
<RX14>
yes
<FromGitter>
<vlazar> 🎉
<FromGitter>
<vlazar> will play with TFB then
<FromGitter>
<j8r> @vlazar the simplest, try https://alpinelinux.org/downloads/ generic arm64. if it works, `apk add --update crystal shards g++ gc-dev libc-dev libevent-dev libxml2-dev llvm llvm-dev llvm-libs llvm-static make openssl openssl-dev pcre-dev readline-dev yaml-dev zlib-dev` and you are done
<FromGitter>
<vlazar> thanks again @j8r
akaiiro has quit [Remote host closed the connection]
<FromGitter>
<rishavs> Hmmm... protecting a route with jwt really ins't as heavy as I was worried. A protected route (Routing + DB call + JWT Decode) takes 280 ms and an unprotected route for the same resource took 254 ms.
<FromGitter>
<vladfaust> Fixed with `&block : {{type.type}} -> _`, sorry.
<wontruefree>
Why does HTTP::Server bind to multiple addresses? I am just curious what the usecase is
<FromGitter>
<n00ax> @j8r What do you define as not supported, Crystal executables link and run fine (at least as far as my experience goes up to this point) with GLIBC statically linked
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
<FromGitter>
<vladfaust> Is there a standard way to return an Iterator for hash *values* by *key* Iterator? E.g. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I need this select with only one argument, which is a key. [https://gitter.im/crystal-lang/crystal?at=5b2d34a3d2abe4668880a144]
<FromGitter>
<bew> @vladfaust sth like that: `hash.each.select { |(k, *)| k >= 42 }.map { |(*, v)| v }`
rocx has quit [Remote host closed the connection]
sz0 has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 245 seconds]
prutheus has joined #crystal-lang
<FromGitter>
<hmans> What’s going on, Crystallizers… okay, I’m beginning to sound lame
<FromGitter>
<vladfaust> @bew, `select` should be with a single argument
<FromGitter>
<drum445> or maybe you already can and I'm not aware
prutheus has joined #crystal-lang
<prutheus>
"can't cast YAML::Any to Array(Int32)" .... I have a array of Int32 | Array(Int32) dumped by YAML and want to recover it via parsing the string now. Then, I want to apply .to_json to the parsed yaml, but there it complains no overload matches 'YAML::Any#to_json' with type JSON::Builder ... so I want to convert the YAML parsed stuff to an Array ... oh man what is crystal doing with the types?
<prutheus>
Any Idea how I can achieve my goal?
<FromGitter>
<vladfaust> In this cases I randomly try `to_a`
<FromGitter>
<vladfaust> Sometimes it helps
<prutheus>
nope
<prutheus>
undefined method 'to_a' for YAML::Any (did you mean 'to_s'?)
<FromGitter>
<vladfaust> If it doesn't help I pray to God and curse asterite (not really)
<prutheus>
What?
<FromGitter>
<vladfaust> I'm high level guy and Crystal types is always challenging for me. I haven't worked neither with JSON nor YAML so close, so I'm out of help here, sorry
<prutheus>
Oh shit. I thought switching from ruby to crystal would be a nice choice, but the type stuff is really strange at some points
<prutheus>
i need to fix my issue, please ....
<jeromegn>
prutheus: there's .as_a
<prutheus>
yes right
<prutheus>
i was misstyping it, but still an error
<FromGitter>
<hmans> wontruefree: yeah, the one that shipped with it -- 0.8.0 -- maybe this is the regression that 0.8.1 fixed? (Speaking of which, is there a way to use a newer shards?)
<FromGitter>
<crash2burn_twitter> yea u need to upgrade, shards are screwed with .0
<FromGitter>
<hmans> @crash2burn_twitter - but how? I was assuming shard releases are tied to crystal releases
<FromGitter>
<hmans> My project is using the 0.25.0 docker image
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter>
<bew> prutheus: what you don't understand?
<prutheus>
What exactly happens if I write down the type it should be and then apply .from_yaml ?
<FromGitter>
<hmans> This could be a borked cache, tho.
<FromGitter>
<hmans> It wasn't. :(
<FromGitter>
<hmans> So, is there going to be an updated docker image with 0.25.0 but shards 0.8.1?
wontruefree has joined #crystal-lang
<FromGitter>
<phalcondroid> Hi there, im sorry about this questing i think a lot people ask to the same, what is a better crystal web framework to learn?
rohitpaulk has quit [Ping timeout: 256 seconds]
Jenz has joined #crystal-lang
<FromGitter>
<hmans> @phalcondroid What do you want to get out of it?
<FromGitter>
<hmans> None of them will make you super-productive right now, since things keep changing so much.
<FromGitter>
<hmans> I've forked the sentry repository and removed the offending 1.0.0 tag. It works now.
prutheus has quit [Quit: Page closed]
pwned has quit [Ping timeout: 264 seconds]
<FromGitter>
<infinitary_twitter> Hi all, first timer here. Migrating some Ruby program of mine that needs to resolve user (and group) names from user (and group) ids. Ruby has an Etc module that somehow does the magic (on the Mac this is not in /etc/passwd). Any ways to get this info simply (and efficiently)?
<FromGitter>
<infinitary> Hi all, first timer here. I am porting some Ruby program of mine that needs to resolve user (and group) names from user (and group) ids. Ruby has an Etc class that does this somehow (on the Mac this info is not in /etc/passwd). Is there a way to get this info simply (and efficiently) in Crystal?
lvmbdv has joined #crystal-lang
<FromGitter>
<drum445> @phalcondroid Kemal
<FromGitter>
<hmans> Am I the only person who stumbled over the many unexpected routing bugs in the routing library used by Kemal?
<FromGitter>
<hmans> With apologies to Serdar, I did not have a good time with Kemal. (Though it was mostly radix' fault.)
<FromGitter>
<rishavs> @hmans what kind of bugs?
<robacarp>
hmans: radix caused me a lot of pain
<robacarp>
that pain resulted in amber_router
duane has quit [Ping timeout: 256 seconds]
<FromGitter>
<rishavs> How do I define a function which can take arguements which may or may not exist? for eg. `def myfunc(xxx)` and `def myfunc()` should both be valid
<robacarp>
you can define both and let the compiler decide which to use
<robacarp>
you can also make the argument nilable, like this: `def myfunc(xxx = nil)` but I recommend avoiding that
<FromGitter>
<confact> Also get errors on the HTTP::Headers{}
<FromGitter>
<hmans> @phalcondroid Amber, Lucky and Kemal are definitely worth watching/learning from.
<FromGitter>
<hmans> If your goal is to eventually attain some level of productivity, I'd say Lucky and Amber are the safer bets.
<FromGitter>
<girng> LOL glad to see @OvermindDL1 in the godot repo
<FromGitter>
<girng> I was like.. i recommend that username!
<FromGitter>
<girng> remember*.. fail
duane has quit [Ping timeout: 240 seconds]
<OvermindDL1>
Lol
<FromGitter>
<girng> although, i'll never use typed gdscript, but it was interesting to read over that issue ;)
<FromGitter>
<paulcsmith> @hmans wasn’t just you. Lucky used radix for a bit but I ran into show stopper bugs pretty early and wrote a different router to get around it
<FromGitter>
<paulcsmith> Routing is hard to get right! So many edge cases
<FromGitter>
<hmans> @paulcsmith Whenever I end up writing some sort of microframework for a project -- like it just happened with my Crystal project -- I like to stick to the routing tree approach (without a separation of "routes" and the code they map to.)
<FromGitter>
<paulcsmith> @phalcondroid welcome to Crystal! I’d say if you’re looking for a full stack solution Amber or Lucky would be a good fit. Kemal is fantastic for APIs and smaller projects. Amber and Lucky are both for full stack dev and APIs. Both are pretty full featured. Amber takes a more familiar approach that makes it easy to get started. Lucky has a few new ideas that require a bit of learning but make it so that
<FromGitter>
... Crystal can catch more bugs at compile time than in the other frameworks.
<FromGitter>
<paulcsmith> I’m the author of Lucky but I’m trying to be unbiased :)
<FromGitter>
<hmans> (also see https://github.com/soveran/toro for an actually released shard someone pointed me towards. Not terribly complete though.)
wontruefree has quit [Quit: bye]
wontruefree has joined #crystal-lang
wontruefree has quit [Client Quit]
<FromGitter>
<bew> @prutheus if you look at https://github.com/crystal-lang/crystal/blob/master/src/yaml/from_yaml.cr you can see that `from_yaml` is defined on `Object` (so for all types), and will create a `new` object of your type, by calling a constructor that receives a `YAML::ParseContext` and `YAML::Nodes::Node`. In this file you can also see that this constructor exists for all basic types of Crystal, like numbers, Array,
<FromGitter>
... Hash, Enum, etc.. So as soon as your type has this constructor, you can call `from_yaml` on it. Also note that the `YAML.mapping` macro is a helper to generate this constructor for you (it also generates a `to_yaml` method)
<FromGitter>
<sancarn> Anyone have any ideas how easy it'd be to build unit tests specifically looking for compile exceptions, without the whole script failing?
<FromGitter>
<sancarn> I.E. can you handle compile errors with something akin to begin ... rescue ... end
<FromGitter>
<bew> No you can't rescue a compile error
<FromGitter>
<sancarn> Sad times
<FromGitter>
<sancarn> So I guess, write the data to a string, try to compile and read stdout it is...
<FromGitter>
<bew> Yeah, you can build with `crystal build --no-codegen --format json <your_file.cr>` to make the reading easier and avoid building a binary
faustinoaq has joined #crystal-lang
<FromGitter>
<asterite> You shouldn't need to test that something doesn't compile
<FromGitter>
<paulcsmith> I've seached the docs and the Google and I can't find a way to check if an incoming HTTP request is via SSL. There doesn't seem to be a `protocol` method and inspecting the `HTTP::Request` object didn't reveal anything
<FromGitter>
<paulcsmith> FWIW I'm trying to build a middleware that redirects to the SSL version of the request resource