ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | 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
lanodan has joined #crystal-lang
ur5us has joined #crystal-lang
notzmv has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 250 seconds]
Sankalp has quit [Ping timeout: 256 seconds]
Sankalp has joined #crystal-lang
<frojnd> Hi there.
<frojnd> I'm trying to use MD5 function for a file that I just uploaded to the server
<Sankalp> Hello
<frojnd> Not sure how can I perform this with crystal lang
<Sankalp> Perhaps something like this: Digest::MD5.digest
<frojnd> Thank you
jmdaemon has quit [Ping timeout: 246 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
notzmv has quit [Ping timeout: 260 seconds]
<FromGitter> <Blacksmoke16> frojnd: `Digest::MD5.digest &.file(file_path)`
<frojnd> @Blacksmoke16 yes, it prints in bytes e.g.: => Bytes[60, 215, 160, 219, 118, 255, 157, 202, 72, 151, 158, 36, 195, 155, 64, 140] I need hex, so Digest::MD5.hexdigest(file) prints in hex: "3cd7a0db76ff9dca48979e24c39b408c"
<frojnd> Or just: Digest::MD5.hexdigest &.file("./bla.txt")
<frojnd> What's called &. after hexdigest?
<FromGitter> <Blacksmoke16> its the same as like `Digest::MD5.hexdigest { |ctx| ctx.file "./bla.txt" }`
<frojnd> Ok
<frojnd> What's this called? Semanticlly?
<frojnd> s/Semantically/semantically
<frojnd> Ah blocks and procs
<frojnd> While I'm here, What's the meaning of `::` e.g. inside `Digest::MD5`
<frojnd> https://crystal-lang.org/api/1.3.2/Digest/MD5.html It says: Class `Digest::MD5`
<FromGitter> <Blacksmoke16> i dont think its ever explicitly called out anywhere, but its the same as ruby
<FromGitter> <Blacksmoke16> tl;dr its the namespace separator. E.g. https://crystal-lang.org/reference/1.4/syntax_and_semantics/modules.html
<frojnd> Thank you
sorcus has quit [Quit: WeeChat 3.5]
jmdaemon has joined #crystal-lang
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #crystal-lang
sorcus has joined #crystal-lang
<FromGitter> <vgramkris> hi, is there any ways to check if a channel is empty w/o calling receive?
<FromGitter> <wrq> https://carc.in/#/r/d3fx ⏎ ⏎ with large enums, should crystal have a cap on trying to expand cases for exhaustive case?
<FromGitter> <wrq> It's trying to enumerate 308915776 cases here, just as an example
<FromGitter> <Blacksmoke16> @vgramkris i dont think there is. But could probably use `select` to handle the case where there is no value ready to be consumed. E.g. https://lbarasti.com/post/select_statement/#non-blocking-channel-operations
notzmv has joined #crystal-lang
<FromGitter> <vgramkris> thanks George, let me check that
notzmv has quit [Ping timeout: 240 seconds]
ur5us has joined #crystal-lang
wolfshappen has quit [Quit: later]
wolfshappen has joined #crystal-lang