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
Human_G33k has quit [Ping timeout: 256 seconds]
[gnubie] has joined #crystal-lang
<FromGitter> <PlayLights_twitter> Why I can't do this `alias ClientParams = { id: 1, name: "us" }.class` ?
[gnubie] has quit [Ping timeout: 256 seconds]
<FromGitter> <mwlang> when writing a crystal spec and comparing timestamps, what should the `delta` be if I want 1 second accuracy between two timestamps?
<FromGitter> <dscottboggs_gitlab> `1.second`?
<FromGitter> <dscottboggs_gitlab> or maybe `1.second - 0.01.seconds`
<FromGitter> <mwlang> that worked. For some reason, I thought that was a rails thing rather than Ruby thing
<FromGitter> <mwlang> so didn't expect it to work in crystal
<FromGitter> <dscottboggs_gitlab> haha well either way that doesn't tell you whether its a Crystal thing
f1refly has quit [Ping timeout: 260 seconds]
f1reflyylmao has joined #crystal-lang
<FromGitter> <mwlang> True! gotta admit though, if it works in Ruby, high likelihood it was implemented in Crystal....which is one of the reasons I'm loving this language.
robacarp is now known as r0bacarp
baweaver has joined #crystal-lang
chachasmooth has quit [Ping timeout: 272 seconds]
chachasmooth has joined #crystal-lang
<FromGitter> <3n-k1> why does this macro only work if it's excluded from the module? https://play.crystal-lang.org/#/r/9k47
<FromGitter> <Blacksmoke16> well the issue is more so you're using an ivar at the class level
<FromGitter> <3n-k1> does that matter if i'm passing it to a macro?
<FromGitter> <Blacksmoke16> yes, becaues it doesnt exist
<FromGitter> <3n-k1> it doesn't exist at compile time?
<FromGitter> <Blacksmoke16> it doesnt exist within the class, only the instance
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Object.html#delegate(*methods,toobject)-macro
<FromGitter> <Blacksmoke16> prob just should use this tho
<FromGitter> <3n-k1> well yeah but the macro transforms it so that it's only- that works
<FromGitter> <Blacksmoke16> hm
<FromGitter> <3n-k1> why is delegate able to use an instance variable?
<FromGitter> <Blacksmoke16> not sure, maybe passing it via a named arg? :shrug:
<FromGitter> <3n-k1> huh, interesting
return0e[m] has quit [Remote host closed the connection]
psydroid has quit [Write error: Connection reset by peer]
ryanprior has quit [Read error: Connection reset by peer]
hamoko[m] has quit [Remote host closed the connection]
psydroid has joined #crystal-lang
<FromGitter> <mwlang> any idea what's wrong with this? ⏎ ⏎ ```Array.new(10).size.times.map(&:itself) ⏎ # => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ``` [https://gitter.im/crystal-lang/crystal?at=5f3b506b5d0f8f24407a0cfe]
ryanprior has joined #crystal-lang
return0e[m] has joined #crystal-lang
hamoko[m] has joined #crystal-lang
<FromGitter> <wyhaines> @mwlang Calling `times` like you did returns an instance of `Iterator` (a `TimesIterator`). Calling `map` on that just returns another kind of `Iterator`. However, if you call `to_a` on that, the iterator is traversed, and you end up with an array again. ⏎ ⏎ ```Array.new(10,0).size.times.map {|i| i}.to_a``` [https://gitter.im/crystal-lang/crystal?at=5f3b553d85c0f2132fd66668]
<FromGitter> <mwlang> @wyhaines Thanks for explaining that. I didn't know how to interpret what Crystal compiler was telling me. Now it makes perfect sense.
<FromGitter> <wyhaines> @mwlang FWIW, you can achieve the same effect more simply: `Array.new(10) {|i| i}`
zorp has joined #crystal-lang
<FromGitter> <grkek> Hello
<FromGitter> <grkek> I did an example project for the Grip framework, if anyone is interested in it check it out https://github.com/grkek/bakuriani
<FromGitter> <grkek> @Blacksmoke16 1 star and we are on-par with popularity of our frameworks
HumanG33k has joined #crystal-lang
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo21 has joined #crystal-lang
alexherbo2 has joined #crystal-lang
alexherbo21 has quit [Read error: Connection reset by peer]
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
alexherbo20 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo20 is now known as alexherbo2
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo2 has joined #crystal-lang
psydroid has quit [Quit: killed]
ryanprior has quit [Quit: killed]
return0e[m] has quit [Quit: killed]
hamoko[m] has quit [Quit: killed]
return0e[m] has joined #crystal-lang
hamoko[m] has joined #crystal-lang
ryanprior has joined #crystal-lang
psydroid has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 256 seconds]
f1refly has joined #crystal-lang
<FromGitter> <alexherbo2> how to alias a method?
<FromGitter> <alexherbo2> I want `get` with no parameter to forward to `all`
<FromGitter> <alexherbo2> (I have multiple `get` implementation`
<FromGitter> <alexherbo2> how to display the help of a subcommand? (what `mycommand -h subcommand` show)
<FromGitter> <alexherbo2> I want to add a `:show` command displaying the subcommands of it
<FromGitter> <neutrinog> hey I can't seem to get HTTP::Cookie working. I'm creating a cookie and adding it to the response but it's not showing up in the browser. Any suggestions?
<FromGitter> <neutrinog> nvm. there was a problem with my cookie settings.
<FromGitter> <wyhaines> @alexherbo2 ⏎ ⏎ ```def get ⏎ all ⏎ end``` ⏎ ⏎ There is no built-in alias functionality. [https://gitter.im/crystal-lang/crystal?at=5f3bc531a05e464346d1ca74]
<FromGitter> <wyhaines> @alexherbo2 You should be able to write a macro to implement a method alias functionality, if you really want it, but the general Crystal philosophy is that if we have one way of calling something, we don't need 2. If you are replacing one method with another in your API, just manually create the alias, and when it's appropriate in your product release cycle, mark the old one as deprecated: ⏎ ⏎
coderobe has quit [Quit: Ping timeout (120 seconds)]
HumanG33k has quit [Ping timeout: 256 seconds]
HumanG33k has joined #crystal-lang
coderobe has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #crystal-lang
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 240 seconds]
postmodern has joined #crystal-lang
alexherbo29 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo29 is now known as alexherbo2
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 264 seconds]
deavmi_ has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
<FromGitter> <alexherbo2> how to continuously capture command output?
<FromGitter> <alexherbo2> I want to execute code with inotifywait monitoring
r0bby has quit [Ping timeout: 246 seconds]
r0bby has joined #crystal-lang
<jhass> use Process.run with a block, you're yielded an instance of Process, Process#output is an IO
deavmi_ has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
zorp has quit [Ping timeout: 264 seconds]
<FromGitter> <spencerking> I'm trying to write a library and am running into some issues. My library module has a method called "tokenize" but in my spec when I try to call LIBRARY.tokenize I get the error undefined method 'tokenize' for module
<FromGitter> <Blacksmoke16> did you define it as `def self.tokenize`?
<FromGitter> <spencerking> I did not, let me try that
<FromGitter> <spencerking> That seems to have worked, thanks for the help
<FromGitter> <alexherbo2> is it possible to sort a hash by their keys?
<FromGitter> <Blacksmoke16> other than creating a new hash and inserted the items in order? no
lanodan has quit [Ping timeout: 260 seconds]
lanodan has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> hash order isn't guaranteed, though, right? so the only way would be to do like `.each.to_a` and sort by the first element of the tuple
<FromGitter> <Blacksmoke16> Hashes are ordered, says so in the API docs
<FromGitter> <Blacksmoke16> That the order is based on insert order
<FromGitter> <dscottboggs_gitlab> ok then