jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
deavmi has quit [Ping timeout: 256 seconds]
deavmi has joined #crystal-lang
_whitelogger has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 264 seconds]
chachasmooth has quit [Ping timeout: 246 seconds]
chachasmooth has joined #crystal-lang
chachasmooth has quit [Ping timeout: 260 seconds]
chachasmooth has joined #crystal-lang
chachasmooth has quit [*.net *.split]
Welog has quit [*.net *.split]
olbat has quit [*.net *.split]
davic has quit [*.net *.split]
robacarp has quit [*.net *.split]
robacarp has joined #crystal-lang
olbat has joined #crystal-lang
Welog has joined #crystal-lang
chachasmooth has joined #crystal-lang
davic has joined #crystal-lang
postmodern has joined #crystal-lang
zorp has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
postmodern has quit [Remote host closed the connection]
woodruffw has quit [Ping timeout: 240 seconds]
Nekka has quit [Quit: zzz]
Nekka has joined #crystal-lang
woodruffw has joined #crystal-lang
postmodern has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
tsujp has joined #crystal-lang
<tsujp> hello fellow crystal fiends
<tsujp> crystal looks very nice indeed
<FromGitter> <naqvis> welcome aboard tsujp
<FromGitter> <Aaron-JM> Hey everyone, I am currently facing Error: undefined constant Include, is @[Include()] not supported anymore??
<FromGitter> <Aaron-JM> Thanks @naqvis
<FromGitter> <naqvis> 👍
<FromGitter> <naqvis> but if you are looking for automatic binding generator then take a look at crystal_lib (https://github.com/crystal-lang/crystal_lib)
<FromGitter> <naqvis> this supports `Include` annotation
woodruffw has quit [Ping timeout: 265 seconds]
woodruffw has joined #crystal-lang
deavmi has quit [Ping timeout: 246 seconds]
deavmi has joined #crystal-lang
lunarkitty has quit [Ping timeout: 246 seconds]
lunarkitty has joined #crystal-lang
deavmi has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <acoolstraw> hey there
deavmi has quit [Quit: Eish! Load shedding.]
alexherbo2 has joined #crystal-lang
<FromGitter> <naqvis> \o
deavmi has joined #crystal-lang
<FromGitter> <asterite> So it seems a few folks at Manas are on vacation, that's why there are no recent commits. Plus they have some other work to do. All of this just to say: don't worry, Crystal isn't going to disappear
fifr has quit [Ping timeout: 272 seconds]
fifr has joined #crystal-lang
<FromGitter> <aravindavk> @asterite Good to know, Thanks for the update.
alexherbo2 has quit [Ping timeout: 240 seconds]
duane has joined #crystal-lang
xyhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #crystal-lang
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #crystal-lang
<FromGitter> <alexherbo2> yo
<FromGitter> <dscottboggs_gitlab> I made a thing 😀 ⏎ ⏎ https://github.com/dscottboggs/jenerator
<FromGitter> <Blacksmoke16> o/
<FromGitter> <alexherbo2> how to recursively list all files?
<FromGitter> <alexherbo2> my use case is to build a json file from snippets
<FromGitter> <alexherbo2> dir
<deimos_> Dir.glob?
* FromGitter * alexherbo2 checks
MasterdonX has quit [Ping timeout: 260 seconds]
duane has quit [Ping timeout: 264 seconds]
<deimos_> https://crystal-lang.org/api/0.35.1/Dir.html#glob(*patterns:Path%7CString,match_hidden=false):Array(String)-class-method
duane has joined #crystal-lang
MasterdonX has joined #crystal-lang
<FromGitter> <alexherbo2> Dir.glob(File.join("/path/to/snippets", "*"), File.join("/path/to/snippets-2", "*")) and filter files?
<FromGitter> <dscottboggs_gitlab> I think it would be ⏎ ⏎ ```Dir.glob "/path/to/snippets/**"``` [https://gitter.im/crystal-lang/crystal?at=5f36e0c060892e0c697096ec]
<FromGitter> <alexherbo2> `File.join` will not work with wildcard ?
<FromGitter> <dscottboggs_gitlab> oh, you're right, sorry, I didn't look at what you said after you edited it
<FromGitter> <alexherbo2> how irc users see edit btw?
<FromGitter> <dscottboggs_gitlab> yes, I've always wondered this too
* FromGitter * dscottboggs_gitlab tries to load hexchat
<alexherbo2> there is nothing :p
<FromGitter> <dscottboggs_gitlab> hm, that's unfortunate
<FromGitter> <Blacksmoke16> @dscottboggs_gitlab i remember seeing something similar to that on reddit
<alexherbo2> edit is just not displayed, there is no new output
<FromGitter> <dscottboggs_gitlab> hm, I looked on shardbox and didn't see anything
<deimos_> yeah, irc users don't see edits
<alexherbo2> is there something like pipe in crystal?
<alexherbo2> from elixir
<FromGitter> <dscottboggs_gitlab> no
<FromGitter> <dscottboggs_gitlab> there was an RFC for it a while back, and it was not added
<FromGitter> <dscottboggs_gitlab> the closest we have are chainable methods
<deimos_> IO::Pipe?
<FromGitter> <dscottboggs_gitlab> no it's where you can call a chain of functions on the result of the previous one
<deimos_> ok
<FromGitter> <Blacksmoke16> @dscottboggs_gitlab nvm, it was written in JS
<FromGitter> <Blacksmoke16> https://github.com/molnarmark/jsontocr
<FromGitter> <Blacksmoke16> and used `JSON.mapping`
<FromGitter> <dscottboggs_gitlab> oh I see
<FromGitter> <dscottboggs_gitlab> good find @Blacksmoke16
<FromGitter> <Blacksmoke16> thought i saw something about it 😆
<FromGitter> <alexherbo2> for my implem, is is better to stay with string or create a path obj?
<FromGitter> <dscottboggs_gitlab> yeah, alexherbo2, I see the advantage for a language with lots of top-level functions like in the JS example in your link, but not in languages with idiomatic method-chaining
<FromGitter> <dscottboggs_gitlab> @alexherbo2 up to you
<FromGitter> <dscottboggs_gitlab> Path gives you `#/` if you need to traverse paths a lot, and improves cross-platform compat so if you need those then use it and if not then don't
alexherbo21 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo21 is now known as alexherbo2
<FromGitter> <alexherbo2> what is the cleanest way to separate the leading path (the snippets paths, before the glob)?
<FromGitter> <alexherbo2> `[[full_path_1, relative]...]`
<FromGitter> <alexherbo2> I just have this crash test for now
<FromGitter> <alexherbo2> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f36e72fe8eb3939a4918ddf]
<FromGitter> <jwoertink> I'm trying to copy this ruby code over to crystal dealing with OpenSSL::Cipher, and there's this line `c.update(plaintext) + c.final`
<FromGitter> <jwoertink> `Error: no overload matches 'Slice(UInt8)#+' with type Slice(UInt8)`
<FromGitter> <alexherbo2> `bin/snippets snippets /home/alex/.config/kak/snippets`
<FromGitter> <jwoertink> I'm assuming in ruby it's just concatenating these strings. Do I need to convert them to string and do the same for crystal?
<FromGitter> <dscottboggs_gitlab> I don't think you *should* convert it to a string in this context but you can concatenate two slices, if no other way than by creating a new slice from the values of the other two
<FromGitter> <dscottboggs_gitlab> lemme work something up, this looks like fun 😉
<FromGitter> <jwoertink> haha ok
<FromGitter> <alexherbo2> hm
<FromGitter> <alexherbo2> I think I need something like "walk", not `Dir.glob` actually
<FromGitter> <dscottboggs_gitlab> @jwoertink https://carc.in/#/r/9jou
alexherbo2 has quit [Ping timeout: 240 seconds]
<FromGitter> <jwoertink> that's neat, but looks a lot more complicated than `String.new(a) + String.new(b)`. Is there major benefits over that?
<FromGitter> <dscottboggs_gitlab> yes, Slice is a pretty low-level type and doesn't really come with any niceties like that. In this case, you have more control over how the slices work. Would `Bytes#+(Bytes)` reuse the left-hand buffer like I did in my example, or create a new buffer to avoid side-effects? ⏎ ⏎ Additionally, the String struct contains data other than the bytes of the text, so I'm not sure if that would have an
<FromGitter> ... impact when working with a cryptographic library
<FromGitter> <jwoertink> Ah, I see.
<FromGitter> <jwoertink> I guess I only have to write this once 😂 thanks!
<FromGitter> <dscottboggs_gitlab> lol
<FromGitter> <jwoertink> Anyone know what the crystal version of `c.auth_tag` is https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-auth_data-3D
<FromGitter> <jwoertink> I don't see that `OpenSSL::Cipher` has it defined
<FromGitter> <dscottboggs_gitlab> that looks like something set by ruby... ⏎ ⏎ ```rb_scan_args(argc, argv, "01", &vtag_len); ⏎ if (NIL_P(vtag_len))``` [https://gitter.im/crystal-lang/crystal?at=5f36ec73ce98da26ecc99661]
<FromGitter> <jwoertink> hmm... I have to encrypt this string in my rails app, then decrypt it in Lucky and vice versa. I got it to encrypt in crystal, but when I decrypt in ruby, it tells me I have to set the auth_tag
<FromGitter> <jwoertink> Where it's doing `tag = c.auth_tag(96 / 8)`
<FromGitter> <dscottboggs_gitlab> oof
<FromGitter> <jwoertink> But using your example did work
<FromGitter> <jwoertink> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f36ed07367ff60c32b2d6be]
<FromGitter> <dscottboggs_gitlab> 👍
alexherbo2 has joined #crystal-lang
sorcus has quit [Ping timeout: 272 seconds]
sorcus has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> @Blacksmoke16 `{% verbatim %}` didn't work... any advice? https://carc.in/#/r/9joz
<FromGitter> <Blacksmoke16> add a `{% begin %}`/`{% end %}` as well
<FromGitter> <dscottboggs_gitlab> before or after the def and verbatim?
<FromGitter> <Blacksmoke16> just inside the `verbatim` stuff
<FromGitter> <dscottboggs_gitlab> it looks like that worked? https://carc.in/#/r/9jp2
<FromGitter> <Blacksmoke16> 👍
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<oprypin> how can i json-serializable `{"foo": [1, 2, 3], "bar": [2, 3, 4]}` as `@name : String; @values : Array(Int32)`
<oprypin> or rather as an array of that
<oprypin> so far im thinking `class Thing < Array(Int32); property! name : String; end` and manually popualte them
zorp has quit [Ping timeout: 264 seconds]
<FromGitter> <Blacksmoke16> what would an example of the values be in the type?
<FromGitter> <Blacksmoke16> wouldnt that just be like `Hash(String, Array(Int32)).from_json json_str`?
<oprypin> Blacksmoke16, i just want crystal to pretend that `{"foo": [1, 2, 3], "bar": [2, 3, 4]}` is actually `[{"name": "foo", "values": [1, 2, 3]}, {"name": "bar", "values": [2, 3, 4]}]` and deserialize that
<FromGitter> <Blacksmoke16> ohh i see
<FromGitter> <Daniel-Worrall> You want a custom converter
<oprypin> just how custom would this be
<FromGitter> <Blacksmoke16> yea prob would be the best approach
<oprypin> as it's acting at the very top level, it seems
<FromGitter> <Blacksmoke16> iterate with the pull parser directly
<oprypin> na
<FromGitter> <Blacksmoke16> interact*
<oprypin> ooh
<FromGitter> <Blacksmoke16> something like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f3710bfba27767ee5ef9828]
<oprypin> heres what i have btw https://carc.in/#/r/9jqg
<oprypin> Blacksmoke16, thats very nice :)
<FromGitter> <Blacksmoke16> challenge will be applying that to a class, as normally converters are specific to a specific ivar
<FromGitter> <Blacksmoke16> oh
<FromGitter> <Blacksmoke16> https://carc.in/#/r/9jql
<FromGitter> <Blacksmoke16> prob would do it
<FromGitter> <Blacksmoke16> 🚀
<oprypin> Blacksmoke16, wait how does your example work
<oprypin> MyType.new returns Array(MyType) ??
<FromGitter> <Blacksmoke16> yea, there isnt a contract that `.new` has to return an instance of self
<oprypin> hmmm
<FromGitter> <Blacksmoke16> actually sec
<FromGitter> <Blacksmoke16> yea, thats the cleanest way to do it
<FromGitter> <Blacksmoke16> (that i can think of atm), assuming you never need to actually create a singular instance from json
<FromGitter> <Blacksmoke16> main issue is the input JSON isn't really an array
zorp has joined #crystal-lang
<oprypin> Blacksmoke16, wow. just wow. i cant believe what i have just done
<FromGitter> <Blacksmoke16> Good stuff
<FromGitter> <Blacksmoke16> Pretty good solution
zorp has quit [Read error: Connection reset by peer]
<oprypin> well dang, it breaks if `values` is not an `Array`. gets the next thing instead
<oprypin> doesnt matter
postmodern has quit [Quit: Leaving]
<FromGitter> <Blacksmoke16> could just validate its an array, or raise