ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <fenicks> Hi guys. ⏎ is it possible to retrieve JSON data from HTTP with NamedTuple containing optional field (not always in JSON ) ?
<FromGitter> <Blacksmoke16> example?
lucasb has quit [Quit: Connection closed for inactivity]
<rkeene> ls
<FromGitter> <sam0x17> you could `(x || "").to_json` it maybe?
<FromGitter> <fenicks> Like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d560674beba830fff9e57c5]
<FromGitter> <tenebrousedge> set the type to nilable? ⏎ https://crystal-lang.org/api/0.23.1/JSON.html#mapping%28properties%2Cstrict%3Dfalse%29-macro
<FromGitter> <asterite> Yeah, nilable fields should be skipped by NamedTuple but that's not the case right now
<FromGitter> <asterite> Please submit a feature request issue, thank you!
<FromGitter> <tenebrousedge> 👀
<FromGitter> <asterite> For now use a struct or class with json mapping or Serializable
<FromGitter> <fenicks> Ok, for now I'll do that with json mapping and hook my database driver because it allow crystal data type or JSON:Any to perfom query. ⏎ I'll look at Serializable too because I don't know how it works ;-). ⏎ Thanks.
DTZUZU has quit [Quit: WeeChat 2.2]
DTZUZU has joined #crystal-lang
<FromGitter> <sam0x17> anyone familiar with `kemal-spec` know how to have multiple requests preserve their session / cookie jar between requests?
<FromGitter> <sam0x17> looks like I can pass in a `HTTP::Headers`, but not sure how to get the one from the previous request
<FromGitter> <sam0x17> @sdogruyol ^
<FromGitter> <sam0x17> sorry `spec-kemal` not `kemal-spec`
alex`` has quit [Ping timeout: 244 seconds]
<FromGitter> <sam0x17> I figured it out
<FromGitter> <sam0x17> basically made this helper: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d561c609507182477e780df]
<FromGitter> <sam0x17> (this is for an API so everything is JSON)
<FromGitter> <Blacksmoke16> mm JSON API
<FromGitter> <sam0x17> yeah its pretty tasty
<FromGitter> <Blacksmoke16> hows kemal working out?
<FromGitter> <sam0x17> taking an ancient rails app, already converted everything to a progressive web app running in S3 and connecting to rails app just as API server, now cutting rails out of the loop entirely using an up.sh / kemal based lambda API
<FromGitter> <sam0x17> its great, I always end up coming back to it
<FromGitter> <Blacksmoke16> is it a simple API or?
<FromGitter> <sam0x17> so basically converting an 800 line "api controller" to organized crystal code
<FromGitter> <sam0x17> ^
<FromGitter> <sam0x17> I'm super happy with myself for never breaking up that controller on the rails side
<FromGitter> <sam0x17> makes it so easy to port
<FromGitter> <Blacksmoke16> xD
<FromGitter> <sam0x17> so yeah, lool
<FromGitter> <Blacksmoke16> have you looked at Athena at all? would appreciate some feedback from someone familiar with APIs
<FromGitter> <sam0x17> the one cumbersome thing is there isn't very good built in instrumentation for "returning early" from within middleware (in kemal)
<FromGitter> <sam0x17> oh yeah I forgot that's a thing
<FromGitter> <sam0x17> I bet its perfect /facepalm
<FromGitter> <Blacksmoke16> thats my goal 😄
<FromGitter> <Blacksmoke16> could you just not call the next handler?
<FromGitter> <sam0x17> it looks amazing
<FromGitter> <sam0x17> yeah right now I just raise my error message and then have an error 500 handler that renders the error message
<FromGitter> <Blacksmoke16> that works too :P
<FromGitter> <sam0x17> but what you said is probably what I'm supposed to do xD
<FromGitter> <Blacksmoke16> currently rewriting my serialization lib, much much better implementation
<FromGitter> <sam0x17> it looks really nice, love the use of annotations
<FromGitter> <sam0x17> I have yet to play with those
<FromGitter> <sam0x17> I'm too deep in my hacked together setup at this point, but will definitely consider for future projects
<FromGitter> <Blacksmoke16> <3
<FromGitter> <Blacksmoke16> check this out
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d561f891dadc42a117b7ec8]
<FromGitter> <sam0x17> but yeah, things that have been pain points for me so far in general with my various approaches ⏎ ⏎ 1) middleware that returns early is tricky ⏎ 2) all the ORMs are too lazy to have a working CLI and/or have db:create and db:drop commands ⏎ 3) saying `.to_json` at the end of everything is annoying ... [https://gitter.im/crystal-lang/crystal?at=5d561f929507182477e79800]
<FromGitter> <Blacksmoke16> i.e. imagine you set the `/post` endpoint to use `list` group, while the `/post/:id` uses `detail` group
<FromGitter> <sam0x17> ahhh ok thats pretty cool
<FromGitter> <Blacksmoke16> which would look something like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d56207a1db76d0ffede50e4]
<FromGitter> <Blacksmoke16> and all the serialization is handled behind the scenes
<FromGitter> <sam0x17> very cool
<FromGitter> <Blacksmoke16> which really just does `.to_json context`
<FromGitter> <Blacksmoke16> indeed, plus the validation stuff completes the loop :P
<FromGitter> <Blacksmoke16> esp on POST endpoints
<FromGitter> <sam0x17> nice
<FromGitter> <sam0x17> gosh I need to play around with graphql, tho I have a feeling its all too javascripty still
<FromGitter> <Blacksmoke16> which would be a `@[Assert::NotBlank]` on the title, if a user POSTs a blank title, you get ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d562157beba830fff9f039d]
<FromGitter> <Blacksmoke16> i've heard good things
<FromGitter> <Blacksmoke16> heres another example :P
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d5623069507182477e7b017]
<FromGitter> <sam0x17> ahh versioning, very cool
<FromGitter> <Blacksmoke16> plan is to also support custom exclusion strategies, so could also make your own
<FromGitter> <sam0x17> yeah that in particular is super cool
<FromGitter> <Blacksmoke16> say for like ACL stuff or preventing properties from being updated on PUT but allowed to be set in a POST
<FromGitter> <Blacksmoke16> `@[IgnoreOnUpdate]` or something
<FromGitter> <Blacksmoke16> ill keep you posted, no pun intended xD
<FromGitter> <sam0x17> hah
ht_ has joined #crystal-lang
ht_ has quit [Read error: Connection reset by peer]
<FromGitter> <absolutejam_gitlab> Could use it akin to how Flask works
<FromGitter> <absolutejam_gitlab> or click
<FromGitter> <absolutejam_gitlab> (Python)
<FromGitter> <absolutejam_gitlab> By prefixing methods with a route/method
<FromGitter> <absolutejam_gitlab> Is there a Crystal equivalent of `go get`?
<FromGitter> <absolutejam_gitlab> maybe an addition to `shards`?
devil_tux has joined #crystal-lang
chemist69 has joined #crystal-lang
absolutejam has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <shdown> What’s the “Crystal way” to define all comparison ops based on `<=>`?
shdown has joined #crystal-lang
<shdown> What’s the “Crystal way” to define all comparison ops based on `<=>`? Is there a standard macro for it or something?
shdown has quit [Remote host closed the connection]
shdown has joined #crystal-lang
<FromGitter> <yxhuvud> shdown: see `Sortable`
<FromGitter> <shdown> @yxhuvud `Comparable`? OK, but why doesn’t it define `!=`?
<FromGitter> <asterite> I think that's defined on Object as the opposite of ==
shdown has quit [Remote host closed the connection]
<FromGitter> <shdown> @asterite OK, thanks!
<FromGitter> <yxhuvud> Yes, it definitely invokes `<=>` in any case.
duane has joined #crystal-lang
absolutejam has quit [Ping timeout: 246 seconds]
absolutejam has joined #crystal-lang
Jenz has joined #crystal-lang
<Jenz> I'm playing with some really weird (and probably stupid) code, and (suprise!) it doesn't work! Anyone know why: https://play.crystal-lang.org/#/r/7euw
<Jenz> -?
<Jenz> Seems the value is not set, in line 9
devil_tu1 has joined #crystal-lang
devil_tux has quit [Ping timeout: 268 seconds]
<FromGitter> <Blacksmoke16> something something passed by copy?
lucasb has joined #crystal-lang
<Jenz> But how? I am modifying an ivar directly in the initializer
<Jenz> Then @bar[c] would be a copy, and that'd be very weird would it not?
<Jenz> How the hell would I set @bar[c][r] then?
<FromGitter> <Blacksmoke16> :shrug: im not super familiar with this
<Jenz> Ah but you're right, thanks; StaticArray is a struct (the whole point of it) and as the nested one also is so, the fetch is by copy...
<Jenz> Seems wholly unpractical to work with nested StaticArrays then
devil_tu1 has quit [Ping timeout: 245 seconds]
<FromGitter> <tenebrousedge> why is `uninitialized` being used?
<FromGitter> <absolutejam_gitlab> any way I can get crystal working on Arch again?
<FromGitter> <absolutejam_gitlab> 1) 1 isn't in repos so I#m trying to build `crystal-git` and it fails on the openssl spec
<FromGitter> <absolutejam_gitlab> oh, there's a tar.gz
<FromGitter> <absolutejam_gitlab> I'll check that
Jenz has quit [Ping timeout: 245 seconds]
<FromGitter> <absolutejam_gitlab> well that was a tar extract gone badly
<FromGitter> <absolutejam_gitlab> overwritten `/lib` and `/bin` lawl
<FromGitter> <tenebrousedge> https://xkcd.com/1168/
<FromGitter> <j8r> mps I was able to build crystal and tests for 0.30.0
<mps_> j8r: on aarch64?
<FromGitter> <j8r> yes, I'm currently rebuilding it to be sure. ⏎ Several notes: I was using `./bin/crystal build -D preview_overflow -D compiler_rt -o .build/all_spec spec/all_spec.cr; .buid/all_spec` and it was when using `git bisect`
<FromGitter> <j8r> I try with `make && make spec`
<FromGitter> <j8r> with `make clean` before
<mps_> this is without any patch to source?
<FromGitter> <j8r> yes
<FromGitter> <j8r> I am compiling it again. I may have errors this time
<mps_> good work! hope you will find cause why it doesn't work
<FromGitter> <j8r> I confirm, it succeeded
<FromGitter> <j8r> Last time I was trying against master. and you, it was 0.30.0 or 0.30.1?
<mps_> I tried both, 0.30.0 and 0.30.1
<mps_> both failed with same errors
<mps_> so, adding '-D preview_overflow' is solution
<FromGitter> <j8r> for me `make spec` do `./bin/crystal build -D preview_overflow -D compiler_rt -o .build/all_spec spec/all_spec.cr`
<FromGitter> <j8r> I'm on a machine with 16GB RAM also, instead of 8GB
<mps_> ok, will try with a great hope
<mps_> iirc, '-D compiler_rt' is default
ht_ has joined #crystal-lang
<mps_> no luck, failed again with same errors
<FromGitter> <j8r> note I am using llvm5
<mps_> aha, so
<FromGitter> <j8r> for me, what works: 0.30.0 LLVM5 aarch64 16GB RAM
<mps_> so have to backport llvm5
<FromGitter> <j8r> I try it again back at home. Crystal shall work on LLVM8
<mps_> it works with llvm8 on x86_64
<FromGitter> <j8r> 1) 30.1 works too
<FromGitter> <asterite> 1) 30.0 is flawed, please try to use 0.30.1
<FromGitter> <asterite> 1) 30.0 should not be used, it has a bug with libevent and another bug with LLVM
<FromGitter> <j8r> 1) 30.1 LLVM5 aarch64 works, LLVM8 not
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
<oprypin> lol nice markdown parser
<oprypin> if you were wondering why everyone started writing "1) 30.1" - actually is "0.30.1"
<oprypin> geez even the message "30.1 isn't in repos" has been turned into "1) 1 isn't in repos"
woodruffw has quit [Ping timeout: 245 seconds]
woodruffw has joined #crystal-lang
lucasb has joined #crystal-lang
<FromGitter> <Blacksmoke16> ruh roh `Error: BUG: CrSerializer::Assertions::IsBlankAssertion(String | Nil) has no types`
<FromGitter> <sam0x17> so why no `.to_sym` for `String`?
<FromGitter> <sam0x17> when you can go `:blah.to_s`?
<FromGitter> <watzon> @sam0x17 because symbols are constants
<FromGitter> <watzon> known at compile time
<FromGitter> <sam0x17> ah ok
<FromGitter> <sam0x17> would be cool if that worked if the string happens to be a symbol that has been compiled
<FromGitter> <sam0x17> and throws an error otherwise
<FromGitter> <sam0x17> I might implement that
<FromGitter> <sam0x17> because that's true 100% of the time for my use cases
<FromGitter> <tenebrousedge> what is your use case?
<FromGitter> <Blacksmoke16> most of times enums should be used instead of symbols
<FromGitter> <watzon> ^
<FromGitter> <Blacksmoke16> can use the symbol to autocast into an enum instance
<FromGitter> <tenebrousedge> Enums are good
<FromGitter> <sam0x17> basically database stuff
<FromGitter> <sam0x17> and yeah, enum would be good
<FromGitter> <watzon> The symbol autocast is one of my favorite Crystal features tbh. I don't think a lot of people realize that it even exists.
<FromGitter> <sam0x17> example?
<FromGitter> <watzon> Basically allows you to have an enum as a value, say `def foo(bar : Foo::Bar::Baz)` where `Foo::Bar::Baz` is an enum, and instead of having to use that full enum namespace when you invoke the method you can just use a symbol, so `foo(:baz)`
<FromGitter> <sam0x17> 0_0
<FromGitter> <sam0x17> love it
<FromGitter> <watzon> It really makes things a lot simpler syntactically
<FromGitter> <watzon> I use it in Tourmaline all the time https://github.com/watzon/tourmaline#listening-for-events
<FromGitter> <Blacksmoke16> who wants to play the fun game of reduce a compiler bug? :S
<FromGitter> <watzon> Oh boy
<FromGitter> <watzon> Lol
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/7eyd is what i got it down to so far
fyber has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/7eyk little better
duane has quit [Ping timeout: 248 seconds]
<FromGitter> <Blacksmoke16> well shit
<FromGitter> <j8r> mps I've pinged @bcardiff if he has an idea
<FromGitter> <bcardiff> don't get too excited about my ideas :-P. Sometimes they are a void pointer.
MasterdonX has quit [Read error: Connection reset by peer]
<FromGitter> <j8r> thanks for the reply
<FromGitter> <j8r> I've compiled with 0.29.0
<FromGitter> <j8r> how can I check if LLVM is built with assertions?
<mps_> j8r: good, and thanks for your persistence in finding solution for the issue
MasterdonX has joined #crystal-lang
<FromGitter> <j8r> np mps_ 👍
ht_ has quit [Ping timeout: 252 seconds]
ht_ has joined #crystal-lang
<FromGitter> <bcardiff> @j8r usually it's not. depends on the distro package ⏎ ⏎ > LLVM_ENABLE_ASSERTIONS:BOOL ⏎ > Enables code assertions. Defaults to ON if and only if CMAKE_BUILD_TYPE is Debug. ⏎ > (ref: https://llvm.org/docs/CMake.html) [https://gitter.im/crystal-lang/crystal?at=5d570acac87a0963e7836769]
<FromGitter> <j8r> there is `DLLVM_ENABLE_ASSERTIONS=OFF`
<FromGitter> <bcardiff> then it's not. :-) `LLVM_ENABLE_ASSERTIONS=ON` is what you want
<FromGitter> <bcardiff> a release build can took 1h. a debug build will be much slower on runtime. choose it you are going to save the build and use it later
<FromGitter> <j8r> and on qemu everything is already 3x slower :(
<FromGitter> <j8r> for the time being mps_, we can either use only llvm5, or have a condition depending of the arch
<mps_> j8r: when I tried 0.30.0 and 0.30.1 it doesn't build with llvm5 nor llvm6
<mps_> didn't tried with llvm7, it is buggy to much
<mps_> will try later (when find some time) to backport llvm5 and build 0.30.1 to see will that work
<FromGitter> <j8r> backport?
<FromGitter> <j8r> llvm5 is still on edge
<mps_> uhm, my bad, llvm5 was moved to unmaintained by mistake but returned back few days ago, I forgot that mess
<mps_> git short log '2019-08-11] bb51a7beb5 unmaintained/llvm5: move from community'
<mps_> and '[2019-08-11] 4948c3c3f2 community/llvm5: move from unmaintained'
<FromGitter> <j8r> O.o'
<FromGitter> <j8r> Oops
<mps_> someone blindly pushed PR from github :/
<mps_> ok, will be easier now ;-)
<FromGitter> <j8r> @bcardiff I compiled with `--no-debug --threads=1`, and got https://github.com/crystal-lang/crystal/issues/8080#issuecomment-522136821. ⏎ Does it help a bit more?
<FromGitter> <absolutejam_gitlab> I tried to extract Crystal from a tar. gz earlier and ended up nuking /bin and /lib
<FromGitter> <absolutejam_gitlab> Knew I should have gone home sooner haha.
<FromGitter> <j8r> haha... nuking?
<oprypin> absolutejam_gitlab, yea... that should never even be considered an option
<mps_> j8r: here is result with llvm5 http://tpaste.us/yP0g
<mps_> build, I mean
<FromGitter> <absolutejam_gitlab> Overwrote them with a reckless sudo untar in a tired Friday state
<FromGitter> <absolutejam_gitlab> Looks like I'll be reinstalling on monday
<FromGitter> <j8r> mps_ I guess that's because there is no `llvm-config50` but `llvm-config5`
<mps_> llvm5-config
<FromGitter> <j8r> hu yes
<FromGitter> <j8r> let me search
<FromGitter> <j8r> yes that's this
<mps_> to fix this we will need to create patch and change source to much
<FromGitter> <j8r> no `llvm5-config`, the closer is`llvm-config50`
<FromGitter> <j8r> no
<FromGitter> <j8r> you can set `LLVM_CONFIG=llvm5-config`
ht_ has quit [Remote host closed the connection]
<mps_> lets see
<mps_> uhm, building kernel and crystal at same time is somewhat prone to make errors :-)
<FromGitter> <watzon> Building a kernel and anything at the same time isn't the best idea
<FromGitter> <watzon> Haha
<FromGitter> <j8r> including building crystal when building crystal... haha
<FromGitter> <watzon> Yeah... lol
<mps_> well, if you have 128GB RAM and 64 cores then problem is keep concentration only ;-)
<FromGitter> <j8r> it only use 1 CPU, excluding the linking part. As long as there is enough RAM, it's usually good
<FromGitter> <j8r> wow
<mps_> j8r: build succeeded http://tpaste.us/YMOw
<FromGitter> <watzon> Damn I wish I had 128GB of RAM
<FromGitter> <watzon> I might finally be able to run Chrome
<FromGitter> <j8r> mps_ 🎉
<mps_> watzon: lol
<FromGitter> <watzon> 😉
<FromGitter> <j8r> you use qemu-kvm mps_??
<mps_> lets try 'specs'
<mps_> no, lxc container
<mps_> on real arm64 hardware
<FromGitter> <j8r> nice
<FromGitter> <j8r> what is it, yours/
<FromGitter> <j8r> ?
<mps_> no, alpine infrastructure
<mps_> packet.com donated, iirc
<FromGitter> <j8r> great :D
<mps_> 'make spec', now have to wait some time
<mps_> j8r: you are so great in your persistence
<mps_> 'make spec' passed link phase and now working on specs :) didn't crashed
<FromGitter> <j8r> thanks for you time too :)
<mps_> I hope good news will be in about half an hour, in meantime a glass of red wine ;-)
<FromGitter> <kingsleyh> Hey - any issues with Crystal 0.30.1 on Alpine Linux? My crystal process on my docker instance dies with an Illegal Instruction
<FromGitter> <kingsleyh> Just since upgrading
<FromGitter> <kingsleyh> From 0.29.0
<mps_> kingsleyh: x86_64?
<mps_> j8r: still here? all passed! now building from clean environment to final check will it pass on official builders
<FromGitter> <j8r> mps_ nice :)
<FromGitter> <j8r> @kingsleyh how did you compile?
<FromGitter> <j8r> I like the percentage progress in CMake
<FromGitter> <j8r> mps_ that's so good you take time on Crystal - despite not being really an user of the language
<FromGitter> <j8r> ...why?
<mps_> you are making interview for press? :D
<mps_> just kidding
<mps_> I plan to use it seriously when it stabilize
<mps_> API/ABI etc
<FromGitter> <j8r> for production projects?
<mps_> yes
<mps_> and it is interesting to follow evolution of the relatively young lang which is not supported by big corp.
<mps_> I prefer software made by devoted people
<mps_> maybe you heard saying "amateurs made Noah ark and professionals made titanic"
<FromGitter> <j8r> agree, good sentence
<mps_> I tried to adopt golang for my $dayjob projects but after about year and a half I stopped
<mps_> and had a hope for rust but it now becoming to heavy for development
<mps_> and you? what are your reasons for such 'love' for crystal?
duane has joined #crystal-lang
<FromGitter> <j8r> haha, love, kinda
<FromGitter> <kingsleyh> I used the alpine Linux crystal docker instance from github
<FromGitter> <kingsleyh> And just - shards build —release
<FromGitter> <j8r> @kingsleyh what image?
<FromGitter> <kingsleyh> Then start up the binary produced and then after about 30 secs it core dumps
<FromGitter> <j8r> don't know, then
<FromGitter> <kingsleyh> That one
<FromGitter> <kingsleyh> The 0.30.1 tag
<FromGitter> <j8r> that's not alpine
<FromGitter> <kingsleyh> Oh I assumed it was
<FromGitter> <kingsleyh> What is it then?
<FromGitter> <Blacksmoke16> ubuntu
<FromGitter> <kingsleyh> I run the docker on Ubuntu and when I run direct on the underlying Ubuntu I have problems
<FromGitter> <kingsleyh> Have no problems sorry direct
<FromGitter> <kingsleyh> On the underlying Ubuntu it works fine
<mps_> j8r: here is late, I hope you will be tomorrow here so we can continue to work in fixing 0.30.1 for Alpine
<FromGitter> <kingsleyh> It has LLVM 4 also
<FromGitter> <j8r> mps_ see you
<FromGitter> <j8r> @kingsleyh if you use the same binary on different OSes, better to compile statically
<mps_> good night to all
<FromGitter> <kingsleyh> I don’t - I compile it in the Dockerfile
<FromGitter> <j8r> good
<FromGitter> <j8r> so, don't know
<FromGitter> <kingsleyh> The only difference is switching up to 0.30.1 so must be related to that I guess
<FromGitter> <kingsleyh> Anyway I’m going to create my own image
<FromGitter> <kingsleyh> And try that
<FromGitter> <j8r> you can try with alpine - lol
<FromGitter> <j8r> good opportunity to have a multistage build
<FromGitter> <j8r> compile statically on alpine, then but the binary on an image `from scratch`
<FromGitter> <renich> Guys, having issues with a YAML.mapping class. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I need a function `get_value( key_name )` or something like that. Could someone give me some guidance? [https://gitter.im/crystal-lang/crystal?at=5d573e70bfd2887f53010aa4]
<FromGitter> <Blacksmoke16> did i solve something like this a while ago?
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Hash.html#key_for(value)-instance-method
<FromGitter> <renich> @Blacksmoke16 yep, it's kind of mondified, but you were the one that wrote the keys method mostly, hehe.
<FromGitter> <Blacksmoke16> :p
<FromGitter> <renich> @Blacksmoke16 but that method doesn't exist for YAML.mapping types...
<FromGitter> <renich> ```code paste, see link``` ⏎ ⏎ That doesn't work. [https://gitter.im/crystal-lang/crystal?at=5d573f241db76d0ffee765c3]
<FromGitter> <renich> `when String then csv.row location, yaml.hostname, k, yaml.key_for(k)` isn't working.
<FromGitter> <Blacksmoke16> whats the error?
<FromGitter> <renich> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d573f6ebb5364334c45d4c5]
<FromGitter> <Blacksmoke16> well in this case `yaml` is `GetVer2CSV::Versions`
<FromGitter> <renich> @Blacksmoke16 which is a YAML.mapping generated method.
<FromGitter> <Blacksmoke16> im confused
<FromGitter> <renich> So, I figured, I had to write my own `get_value(key : String)` method
<FromGitter> <renich> Yeah... me too ;D
<FromGitter> <Blacksmoke16> lets back up, whats the end goal here?
<FromGitter> <Blacksmoke16> build a CSV file?
<FromGitter> <renich> @Blacksmoke16 yes. Flatten a 3D yaml file into a CSV file.
<FromGitter> <renich> I figured I could use a simple component => value scheme so they can use autofilters in a spreadsheet
<FromGitter> <Blacksmoke16> i guess my next question is why :P
<FromGitter> <renich> Administrative people don't like yaml files.
<FromGitter> <renich> I need to gather info from a ton of servers, flatten it into a CSV so they can import it into a spreadsheet and analyze it.
<FromGitter> <Blacksmoke16> do you have the header row of all the keys working?
<FromGitter> <Blacksmoke16> couldnt you just make an array of values at the same time then index of each array would match up?
<FromGitter> <renich> The header row is in one of my examples: `csv.row "location", "hostname", "component", "value"`
<FromGitter> <Blacksmoke16> or something like that
<FromGitter> <renich> And a sample yaml file is: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d5740d7bfd2887f530121ab]
<FromGitter> <renich> Some components might be missing sometimes, though.
<FromGitter> <renich> The command-line utility (which I wrote to try and practice crystal a bit more) is supposed to parse thousands of csv files like these. Then, I can just concatenate (minus the header file) and import into a spreadsheet.