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
ur5us has joined #crystal-lang
<FromGitter> <perfecto25> hi everyone, quick question, how would I run something like rsync in crystal, i cant find any libs or examples that do this. a simple rsync transfer between 2 hosts. Do I need to use C bindings for this?
<FromGitter> <domgetter> This "Using the Compiler" documentation mentions LTO: https://crystal-lang.org/reference/1.3/using_the_compiler/ but LTO was taken out of crystal some time ago, and it's still mentioned in the man page in crystal/man/crystal.1 in the main repo on the master branch. I didn't know what sort of issue to create to fix the issue
<FromGitter> <Blacksmoke16> pretty sure theres a PR to handle the book context
<FromGitter> <Blacksmoke16> @perfecto25 could always ofc just create a subprocess if bindings are not possible
<FromGitter> <perfecto25> @Blacksmoke16 yea ill try that, was wondering if theres a native lib available
<FromGitter> <Blacksmoke16> not saying there isnt, but dont know off the top of my head
ua_ has quit [Ping timeout: 250 seconds]
ua_ has joined #crystal-lang
ur5us has quit [Ping timeout: 256 seconds]
taupiqueur has joined #crystal-lang
ejjfunky has joined #crystal-lang
ejjfunky has left #crystal-lang [#crystal-lang]
SamantazFox has quit [Killed (NickServ (GHOST command used by SamantazFox_))]
SamantazFox_ has joined #crystal-lang
SamantazFox_ has quit [Ping timeout: 240 seconds]
jmiven has quit [Quit: reboot]
jmiven has joined #crystal-lang
kiwiroy has quit [Ping timeout: 250 seconds]
kiwiroy has joined #crystal-lang
nq has joined #crystal-lang
renichbon has quit [Remote host closed the connection]
nq has quit [Quit: Leaving]
* FromGitter * moe:busyloop.net marks day in calendar, that friday when blacksmoke didn't know something off the top of his head
<riza> ^
zantrax has joined #crystal-lang
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
nq has joined #crystal-lang
nq_ has joined #crystal-lang
nq_ has quit [Remote host closed the connection]
taupiqueur has quit [Ping timeout: 250 seconds]
taupiqueur has joined #crystal-lang
ua_ has quit [Read error: Connection reset by peer]
<zantrax> Hi there! is there a way to add a default value to a hash that I am using as a constant? similar to ruby {}.default?
<zantrax> My constant is something like:
<zantrax> Handler = { ".doc" => Text, ".jpg" => Image }
<zantrax> I want to make it so that if the key isn't on the constant, it returns NoResult or some other value
<FromGitter> <Blacksmoke16> Could just use the nilable getter
<FromGitter> <Blacksmoke16> Otherwise if you look at the hash type in the api docs there's a constructor that allows setting a hash wide default
<FromGitter> <Blacksmoke16> The fetch method also allows setting a default specific to that invocation
ua_ has joined #crystal-lang
<zantrax> Right, that might be the way to go!
<zantrax> For reference, this is what I am trying to do:
<zantrax> HANDLER = { ".doc" => Text, ".jpg" => Image }
<zantrax> def self.read(input_file : String)
<zantrax>   extension = File.extname(input_file)
<zantrax>   HANDLER[extension].new(file).read
<zantrax> end
<zantrax> If an unsupported extension, would return NoResult kind of thing, but thats just a weird design from my side I think
<FromGitter> <Blacksmoke16> would it be better to leverage the mime type of the file versus just its extension
<FromGitter> <Blacksmoke16> assuming a `png` and `jpg` should be read the same based on your business logic
<FromGitter> <Blacksmoke16> but id say it depends on how you want things to work. having a method that raises on invalid and one that returns `nil` are quite common
taupiqueur has quit [Ping timeout: 256 seconds]
<FromGitter> <moe:busyloop.net> that moment when you start putting `\`'s in front of your `{%`'s and you kinda know you're in trouble, but it's too good to stop.
<FromGitter> <moe:busyloop.net> lol
<FromGitter> <moe:busyloop.net> that took you almost 10 seconds!
<FromGitter> <Blacksmoke16> :S
<FromGitter> <moe:busyloop.net> high latency today, pfft
<FromGitter> <moe:busyloop.net> `Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /var/cache/omnibus/src/llvm/llvm-10.0.0.src/include/llvm/Support/Casting.h, line 264.`
<FromGitter> <Blacksmoke16> nice
<FromGitter> <moe:busyloop.net> don't ask me how tho 😇