RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.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> <Sija> same for brainy househusbands! ermm… sorry, “houseworkers” (when did this term arrive into the language?)
<FromGitter> <HarrisonB> sorry, not houseworker--homemaker
<FromGitter> <Sija> wow, excuse my ignorance but it's like… a person who makes houses? ;)
<FromGitter> <j8r> anyway, all of this to say: docs are missing for advanced Crystal? yes @talbergs , PRs welcome
<FromGitter> <Sija> to be honest I still have problems with washing-machine manuals at a times, they can be confusing as hell (or I’m too dumb to grok ‘em) :P
<FromGitter> <PlayLights_twitter> Hello everyone! Do you know how to define a instance variable on Crystal Specs? Im getting `can't use instance variables at the top level` but i can't user `let` method since it doesn't exist yet on Crystal Spec
<FromGitter> <HarrisonB> Hi @PlayLights_twitter, can you give a bit more context on what you'd like to achieve?
<FromGitter> <PlayLights_twitter> @HarrisonB Hello, yes, something like this: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I was trying to do this, or using `let(:user) { create_user } ` ... [https://gitter.im/crystal-lang/crystal?at=5c5f6f1b604f233ab6e23d35]
<FromGitter> <PlayLights_twitter> to avoid repeating code
<FromGitter> <Sija> @PlayLights_twitter FWIW I’m using construct like below: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c5f70bf83f3873903890e3f]
<FromGitter> <HarrisonB> @Sija's suggestion works. In this specific instance, the following may work as well ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c5f70df604f233ab6e248f9]
<FromGitter> <PlayLights_twitter> @HarrisonB @Sija I see, thanks both!, im going to try them
<FromGitter> <HarrisonB> From the discussions I've read, it doesn't seem the devs are super interested in non-global `before_each` calls.
<FromGitter> <HarrisonB> There's a minitest port which has the behavior that you also may be interested
<FromGitter> <Sija> the thing with `Spec.before/after_each` is that they're global
<FromGitter> <Sija> atm you can't scope 'em to the given block, they'll be run for *every* `it`, everywhere
<FromGitter> <PlayLights_twitter> So instead of that, each `it`should have an array of before and after blocks that are concatenated from each describe parent before_each block, This said, I have no idea how to implement that 🙄
<FromGitter> <Sija> there was a discussion regarding that (see #5094), perhaps it's a time to re-evaluate the final decision made in there… (I'd love that!)
<DeBot> https://github.com/crystal-lang/crystal/issues/5094 (before_each should be scoped within describe block)
<FromGitter> <Sija> @asterite's comment from the end of '17 seems welcoming (well, sort of ;)): ⏎ ⏎ > If someone wants to implement this, please do so and send a PR. It should support kind of like instance variables, similar to what you can do in `rspec` or `spec2.cr` or `minitest`, otherwise it's pretty pointless. ⏎ > ⏎ > Good luck 😉 [https://gitter.im/crystal-lang/crystal?at=5c5f7459d0d640667f42e840]
<FromGitter> <HarrisonB> @Sija yea, perhaps i misread an earlier PR. sorry for misrepresenting!
<FromGitter> <Sija> @HarrisonB no worries :)
<FromGitter> <maiha> Hmm, there seems to be a case that `HTTP::Client` can not handle `gzip` and `chunked` response correctly. Does someone have similar experiences?
<FromGitter> <Sija> @maiha what r the symptoms?
<FromGitter> <maiha> k, I'll try to make it.
<FromGitter> <maiha> Actual data is `[gzip(chunk1)][gzip(chunk2)]...` , but for example, crystal may handle it as `gzip([chunk1][chunk2]..)`.
<FromGitter> <maiha> I'll make the minimum code and the issue, when I have a time.
<FromGitter> <Sija> @maiha sorry, I don't know what to make of this… :/
<FromGitter> <Sija> maybe `diff`-ing those 2 file would be of some help, dunno...
<FromGitter> <maiha> yep! :)
<FromGitter> <iambudi> Sorry to ask shards here. In crystal-db how to use WHERE IN clausa? Using `"SELECT.. WHERE field IN ?", ary` does not work
<FromGitter> <iambudi> Looks like need to join the array as string with comma separator
<FromGitter> <Blacksmoke16> yes, you'd have to build it out yourself iirc
<FromGitter> <Blacksmoke16> if they are strings you'd also have to use `'` the values
<FromGitter> <Blacksmoke16> but numbers you just need to join them with comma
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 268 seconds]
ashirase_ has joined #crystal-lang
jemc has quit [Ping timeout: 272 seconds]
_whitelogger has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]
<FromGitter> <iambudi> Yes, just wondering if any builtin funcion in crystal to escape string? let say to prevent sql injection?
cyberarm has quit [Ping timeout: 244 seconds]
cyberarm has joined #crystal-lang
<FromGitter> <HarrisonB> You may not need to escape depending on the context, but `crystal-pg` has `PG::EscapeHelper` for manual escaping if needed
marmotini_ has joined #crystal-lang
<FromGitter> <iambudi> Thanks. I need to escape since i use string interpolation to set the value for WHERE IN clausa.
<FromGitter> <r00ster91> do you mean this string interpolation: `"#{123}"`? This sting interpolation doesn't work at runtime. Doing this will result in `#{123}`
marmotini_ has quit [Ping timeout: 245 seconds]
marmotini_ has joined #crystal-lang
<FromGitter> <bararchy> Thanks for the workaround @Sija
marmotini_ has quit [Ping timeout: 268 seconds]
sagax has quit [Ping timeout: 246 seconds]
sagax has joined #crystal-lang
_whitelogger has joined #crystal-lang
ashirase has quit [Ping timeout: 240 seconds]
ashirase_ has quit [Ping timeout: 268 seconds]
ashirase has joined #crystal-lang
ashirase_ has joined #crystal-lang
marmotini_ has joined #crystal-lang
<FromGitter> <iambudi> @r00ster91 Yes that interpolation. ⏎ `ary = “(‘a’,’b’,’c')”` ⏎ `SELECT * FROM table WHERE id IN #{ary}`.
<FromGitter> <iambudi> ary actually come from somewhere as array value and then joined.
<FromGitter> <iambudi> Curious why this shard is archived. https://github.com/RX14/parallel.cr
<FromGitter> <iambudi> that looks good.
marmotini has joined #crystal-lang
marmotini_ has quit [Ping timeout: 250 seconds]
virkony has left #crystal-lang ["WeeChat 2.1"]
<FromGitter> <kingsleyh> There is this too - https://github.com/tbrand/tokoroten
<FromGitter> <bararchy> @iambudi it's archived because it was an experimental work by RX14 which is uneceseray when real MT is implemented: https://github.com/crystal-lang/crystal/pull/7214
<RX14> I don't plan on working on it further
<RX14> And it never really worked at all
<FromGitter> <maiha> Created `curl.cr`. Now I can handle gzip-chunk data in crystal. https://github.com/maiha/curl.cr
marmotini has quit [Remote host closed the connection]
marmotini has joined #crystal-lang
marmotini has quit [Remote host closed the connection]
marmotini has joined #crystal-lang
marmotini has quit [Remote host closed the connection]
marmotini_ has joined #crystal-lang
marmotini_ has quit [Remote host closed the connection]
jemc has joined #crystal-lang
<FromGitter> <vladfaust> Laughed a little :D https://pasteboard.co/I0wrHsN.png
<FromGitter> <sdogruyol> Congrats @maiha 🎉
<FromGitter> <maiha> thanks! :-)
<FromGitter> <Sija> @maiha Did you managed to find out what's the problem with borked gzip output?
jemc has quit [Ping timeout: 250 seconds]
<FromGitter> <maiha> Not yet. It is difficult to clarify the problem. However, I need the function in business in a hurry. Therefore, I created a binding of `libcurl` first.
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
marmotini_ has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter> <talbergs> How to recursive types? https://play.crystal-lang.org/#/r/67xd
marmotini has joined #crystal-lang
marmotini_ has quit [Ping timeout: 240 seconds]
marmotini_ has joined #crystal-lang
marmotini has quit [Ping timeout: 244 seconds]
<FromGitter> <bew> Hmm using `Hash` instead of `M` makes it work, maybe an issue with alias in this case?
Groogy has joined #crystal-lang
<FromGitter> <johanalkstal> Is there a command to quit/stop a command line application programmatically?
<FromGitter> <talbergs> `exit`
<FromGitter> <johanalkstal> Sweet and simple. :) Thanks
Groogy has quit [Quit: WeeChat 2.3]
Groogy has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
g- has joined #crystal-lang
<FromGitter> <talbergs> @bew You think I should open an issue, as if it should work the way I expected?
<FromGitter> <j8r> ouch recursive aliases
<FromGitter> <j8r> you can do like JSON::Any and use a struct which has itself as a getter
<FromGitter> <j8r> IIRC this is a hot topic to keep/remove them - they are known issues
DTZUZU has quit [Quit: WeeChat 2.2]
<FromGitter> <talbergs> Thanks, I looked at JSON::Any src, and now seems that implementing my own type this way, fits to my problem. I wonder what is the top argument *against* a working/quick recursive hashvalue alias that I tried..
<FromGitter> <Blacksmoke16> that it kinda defeats the purpose of static typed lang
<FromGitter> <talbergs> Ok, then we can toss it, providing, a note in docs on that no recursive types supported because of that and here is an example on how to walk around it.
<FromGitter> <Blacksmoke16> well i mean its not that they *arent* supported, just kind frowned upon
<FromGitter> <talbergs> Is there an argument to keep it?
<FromGitter> <Blacksmoke16> as are prob better ways to handle it
<FromGitter> <talbergs> And if this support puts on extra maintenance burden ... another reason to toss it.
<FromGitter> <talbergs> > frowned upon ⏎ But there is a case where is needed. Like the json ... cmon is using json now wrong? :o
<FromGitter> <Blacksmoke16> ;)
<FromGitter> <talbergs> But this imho is heavy argument "maintenance burden" is the most legit reason ;)
<FromGitter> <talbergs> Do not exhaust, this language has to win that market!
<FromGitter> <Blacksmoke16> can read that
<FromGitter> <talbergs> Thanx, will read that.
<FromGitter> <drum445> Interesting, what is the reasoning for having union types over simple nillable types like other langs have?
<FromGitter> <drum445> I agree with most the people in that thread that union types are a nice feature
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
DTZUZU has joined #crystal-lang
ashirase has quit [Remote host closed the connection]
Groogy has quit [Quit: WeeChat 2.3]
marmotini_ has quit [Ping timeout: 250 seconds]
jemc has joined #crystal-lang