havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
SuperLag has quit [Remote host closed the connection]
henninb has joined #ruby
lightstalker has quit [Remote host closed the connection]
yokel has joined #ruby
Ediz has joined #ruby
Ediz is now known as Guest30464
yokel has quit [Ping timeout: 265 seconds]
ur5us has quit [Ping timeout: 240 seconds]
bmurt has joined #ruby
yokel has joined #ruby
ramfjord has quit [Ping timeout: 272 seconds]
zacts has joined #ruby
henninb has quit [Remote host closed the connection]
ramfjord has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
bkuhlmann has joined #ruby
yokel has quit [Ping timeout: 272 seconds]
Secret-Fire has quit [Remote host closed the connection]
Mrgoose has quit [Quit: Ping timeout (120 seconds)]
ur5us has joined #ruby
Mrgoose has joined #ruby
adu has joined #ruby
Secret-Fire has joined #ruby
Secret-Fire has quit [Remote host closed the connection]
Secret-Fire has joined #ruby
yokel has joined #ruby
yokel has quit [Ping timeout: 265 seconds]
Mrgoose has quit [Quit: Ping timeout (120 seconds)]
Rudd0 has quit [Remote host closed the connection]
zacts has quit [Quit: leaving]
jwt has joined #ruby
Mrgoose has joined #ruby
Mrgoose has quit [Client Quit]
Mrgoose has joined #ruby
TCZ has quit [Quit: Leaving]
jwt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sh7d has joined #ruby
jwt has joined #ruby
bruce_lee has quit [Ping timeout: 240 seconds]
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
yokel has joined #ruby
bkuhlmann has quit []
elxbarbosa has joined #ruby
jwt_ has joined #ruby
jwt__ has joined #ruby
jwt_ has quit [Client Quit]
adu has quit [Ping timeout: 246 seconds]
jwt has quit [Ping timeout: 260 seconds]
clemens3 has quit [Ping timeout: 256 seconds]
adu has joined #ruby
clemens3 has joined #ruby
jwt__ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yokel has quit [Ping timeout: 258 seconds]
jwt has joined #ruby
Guest30464 has quit [Ping timeout: 256 seconds]
jwt_ has joined #ruby
jwt_ has quit [Client Quit]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jwt has quit [Ping timeout: 260 seconds]
yokel has joined #ruby
Ediz has joined #ruby
Ediz is now known as Guest51811
yokel has quit [Ping timeout: 272 seconds]
neshpion has joined #ruby
akem has joined #ruby
meinside has joined #ruby
yokel has joined #ruby
cthu| has quit [Ping timeout: 258 seconds]
wallace_mu has quit [Ping timeout: 256 seconds]
yokel has quit [Ping timeout: 240 seconds]
ule has joined #ruby
ule has quit [Changing host]
yokel has joined #ruby
yokel has quit [Ping timeout: 260 seconds]
yokel has joined #ruby
cow[moo] has joined #ruby
adu has quit [Ping timeout: 256 seconds]
ramfjord has quit [Remote host closed the connection]
ramfjord has joined #ruby
FankyCyborg2 has quit [Quit: The Sleep Monster got me!]
adu has joined #ruby
adu has quit [Ping timeout: 272 seconds]
yokel has quit [Ping timeout: 240 seconds]
adu has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zacts has joined #ruby
yokel has joined #ruby
<nakilon> havenwood, "Anyway, Floats are strange."
<nakilon> did you hear? they now made 16 bit float )
<havenwood> nakilon: An academic went 8 bit. Nobody has dared 4 bit. You'll get a PhD if you can muster the courage.
<havenwood> University Of Havenwood is accepting thesis papers.
<havenwood> One bit for the exponent. >.>
<nakilon> actually floats being too long was confusing people -- many thought (and maybe think it today) that having many bits and being float is kind of the same thing
neshpion has quit [Quit: WeeChat 2.9]
<nakilon> havenwood we could use even less than one bit
<nakilon> with Huffman coding
yokel has quit [Ping timeout: 260 seconds]
gix has quit [Ping timeout: 272 seconds]
Rudd0 has joined #ruby
ChmEarl has quit [Quit: Leaving]
donofrio has quit [Remote host closed the connection]
Vingador has joined #ruby
yokel has joined #ruby
Vingador has quit [Ping timeout: 272 seconds]
drincruz has quit [Ping timeout: 260 seconds]
Vingador has joined #ruby
yokel has quit [Ping timeout: 258 seconds]
ur5us has quit [Ping timeout: 244 seconds]
yokel has joined #ruby
adu has quit [Quit: adu]
yokel has quit [Ping timeout: 272 seconds]
yokel has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
<nakilon> havenwood, created a ticket as you recommended: https://bugs.ruby-lang.org/issues/17174
bocaneri has joined #ruby
yokel has quit [Ping timeout: 258 seconds]
cnsvc has joined #ruby
BSaboia has joined #ruby
<nakilon> accidental breaking the last published version of my gem caused multiple bug reports that made me happy to know there are people using it
<nakilon> I wonder what average fraction of people push their code to public Github repos so the real number of users could be estimated by the number of related projects in Github sidebar
yokel has joined #ruby
jmcgnh has quit [Ping timeout: 260 seconds]
jmcgnh has joined #ruby
splud has joined #ruby
<splud> I'm getting a bit of grief with some code that checks for an env variable, turns it into an array: $somevar = (ENV['VARNAME'] ? ENV['VARNAME'] : "").upcase.split(" ")
<splud> going from memory there.
<splud> idea is elsewehere in the code would like to check: if ( $somevar,includes?("FLAG") )
<splud> or unless () etc.
<splud> it is intended as a debug variable, triggering additional verbosity or early exit from a script.
<splud> if the VARNAME isn't defined, I should have an empty string for split to act on, which should result in an empty array, not _nil_ right?
kerframil has quit [Quit: WeeChat 2.9]
dfucci has joined #ruby
<nakilon> $somevar = (ENV['VARNAME'] ? ENV['VARNAME'] : "").upcase.split(" ") ======> $somevar = ENV['VARNAME'].to_s.upcase.split
<splud> and if VARNAME is not defined, do I not a get an error with null.to_s.upcase.split ?
<nakilon> &>> nil.to_s
<rubydoc> # => "" (https://carc.in/#/r/9pqd)
Vingador_ has joined #ruby
zacts has quit [Quit: leaving]
yokel has quit [Ping timeout: 260 seconds]
Vingador has quit [Ping timeout: 272 seconds]
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
yokel has joined #ruby
jinie has joined #ruby
elxbarbosa has quit [Ping timeout: 272 seconds]
<splud> thankls nakilon, though that's just simplifying the env-to-array assignment.
BSaboia has quit [Quit: This computer has gone to sleep]
xco has joined #ruby
sagax has quit [Remote host closed the connection]
<nakilon> splud not sure I understand your problem then; you want to have a special env var with space-separated flag words; the idea looks ok
Nerium has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
Nerium has quit [Ping timeout: 256 seconds]
teclator has joined #ruby
ramfjord has quit [Ping timeout: 272 seconds]
<riceandbeans> Did Chef die off?
yokel has quit [Ping timeout: 240 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sagax has joined #ruby
yokel has joined #ruby
lxsameer has quit [Ping timeout: 246 seconds]
xco has joined #ruby
<splud> ah, sorted it out - elsewhere in code, there was something calling the msg() method that was making use of the debug_flags sooner than intended. Inherited code - someone has inline code buried among function def's.
<splud> gaaa.
<splud> Thank you for your help - I implemented the cleaner split.
<splud> Ad I was off at another console digging
<splud> and.
splud has left #ruby ["Leaving"]
yokel has quit [Ping timeout: 272 seconds]
schne1der has joined #ruby
robinimus has joined #ruby
yokel has joined #ruby
vondruch has joined #ruby
yokel has quit [Ping timeout: 258 seconds]
BSaboia has joined #ruby
lxsameer has joined #ruby
klaas has quit [Quit: ZNC 1.8.1 - https://znc.in]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
klaas has joined #ruby
xco has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
supercoven has joined #ruby
rapha has joined #ruby
<rapha> hi all
<rapha> sooo, a = {name: "Peter"}; b = {name: "Mary"}; a.merge!(b), will end up with a == {name: "Mary"}. if instead I want something like a == {name: ["Peter", "Mary"]}, would that be done by handing a block to #merge! or some other way?
<jhass> rapha: yes, using merge with a block is a possible solution
<rapha> jhass: ... but not the route you would go, yourself?
<jhass> probably it would be :)
<jhass> I never had the need of something like that personally
BSaboia has quit [Quit: This computer has gone to sleep]
<rapha> lucky you :-D
<jhass> I mean in the overall scope of the problem there might even be a nice way to not have those intermediate hashes but built the target hash right away from the source data, dunno :)
<nakilon> rapha, is Shane your name?
<jhass> or maybe hashes is not how I would represent the data at all
<nakilon> you might need wrap values in Array() since they are initially not arrays in your example
<rapha> nakilon: no, I have nothing at all to do with the famous Quake III player if that's what you're getting at. I've had this nick when he was still pooping in his diapers.
<nakilon> lol
<rapha> jhass: these data (deeply nested Hashes and Arrays) have gone through many iterations of how to represent them. In the end, Hashes and Arrays was the least troublesome.
<rapha> nakilon: Yes, that wrapping is what's giving me trouble. Because only when a second thing of something comes along does it need to become an Array. As long as it's only one thing, please no Array.
<nakilon> you mean if the values are the same it should remain a scalar?
<jhass> uh, I hate datastructures that do that
<nakilon> that would need some `if`
<rapha> wait, let me make an example
<rapha> jhass: this is my first time with something like this. trying a lot to not develop any feelings of hate here :-/
yokel has joined #ruby
<jhass> in my experience it just needlessly splatters the code with conditionals for checking whether it's an array or not further down
<nakilon> &>> {a: :b, c: :d, f: [:g]}.merge({a: :b, c: :e, f: :g}){ |_, v1, v2| Array(v1) == Array(v2) ? v1 : Array(v1) + Array(v2) }
<rubydoc> # => {:a=>:b, :c=>[:d, :e], :f=>[:g]} (https://carc.in/#/r/9prn)
<rapha> you don't even want to see my case…when blocks ... *sob*
sleetdrop has joined #ruby
dionysus69 has joined #ruby
yokel has quit [Ping timeout: 272 seconds]
BSaboia has joined #ruby
sleetdrop has quit [Ping timeout: 272 seconds]
tsujp36 has joined #ruby
<tsujp36> How does RSpec's memoisation work? The examples appear completely contradictory...
<tsujp36> On this page, their docs https://relishapp.com/rspec/rspec-core/v/3-9/docs/subject/explicit-subject#use-%60subject(:name)%60-to-define-a-memoized-helper-method
<tsujp36> Example with heading: The `subject` is memoized within an example but not across examples
<tsujp36> Appears to contradict example with heading: Use `subject(:name)` to define a memoized helper method
imode has quit [Ping timeout: 256 seconds]
<tsujp36> Can anyone help? I cannot grok this
<jhass> not sure, I don't think I see the contradiction :) Can you expand?
<tsujp36> Okay so as a tiny preface to that in the same page: `his helper method is memoized.The value is cached across multiple calls in the same example but not across examples` is this referring just to the helper method name or to both the helper method name and the subject?
<tsujp36> It reads like the former but I assume it's the latter?
<jhass> subject behaves the same, no matter whether you call it as "subject" or with an explicit given name
funnel has quit [Ping timeout: 240 seconds]
* nakilon just does not use this fancy subject thing at all
<tsujp36> Okay so it's referring just to the helper name, so onto the within-an-example bit
<jhass> in other words, subject { .. } is largely equivalent to let(:subject) { .. } and subject(:foo) { .. } is largely equivalent to let(:foo) { .. }
<tsujp36> Their example of " The `subject` is memoized within an example but not across examples " reads to me as making a local variable (for example purposses as they say), and defining the subject as that variable with the last item, `3` popped off such that it is now [1, 2] (still typing)
<jhass> "it" = "the local variable"
<jhass> yes
<tsujp36> So now within the example we have an expect and it trys to re-create the subject 3 times, `3.times { subject }` but as this is memoized that only really runs ones, so thats just avoiding performance loss. So the rest of that check of 1, 2, 3 to 1, 2 passes
<tsujp36> But how does the next line of .eq(3) pass if the subject is [1, 2]?
<jhass> subject is the return value of the block, so the return value of pop here
<jhass> the first expectation is on element_list, not subject
<tsujp36> OHHHHHHHHHHHHH
<tsujp36> ugh im an idiot, element_list.pop evaluates to 3
<jhass> :)
<tsujp36> .'. subject equals 3
<tsujp36> okay let me see if I dun goofed the second example
<jhass> sure :)
<tsujp36> okay the second one with `$count` doesn't change it because the inputs don't change, it's just `2.times { global_count }`
<tsujp36> so `global_count` and `global_count` = no input change = only run it once = $count stays at 1
yokel has joined #ruby
<jhass> nakilon: it's mostly handy when combined with the shorthand expectation stuff, subject { foo }; it { should be bar }; not sure that's still around with should being phased out though?
<nakilon> yeah, should became obsolete years ago, but anyway, you are adding the knowledge about special commands of the Rspec DSL just to short some lines by 203 characters
<nakilon> and if it "wasn't a big knowledge" then you won't even come to ask us how does it work
<nakilon> *2-3 characters
<jhass> tsujp36: sounds about right :)
<tsujp36> perhaps I should've taken 5 and done this step through before coming to IRC hoho
<tsujp36> dumb mistakes gonna happen I guess
<tsujp36> Thank you jhass
<jhass> nah, don't worry :)
<jhass> yw
<tsujp36> If you have a thing to buy you coffee with lmk, cos you helped me before too
<jhass> nakilon: looks like they're keeping around should for that syntax, even when disabled otherwise
<jhass> you can do is_expected.to alternatively but that becomes pretty moot indeed
cnsvc has quit [Ping timeout: 240 seconds]
<tsujp36> what's wrong with is_expected.to ?
<tsujp36> is there an alternative to both is_expected.to and shoulda?
<tsujp36> should*
cnsvc has joined #ruby
<jhass> if the goal of the mechanism is to make things shorther, is it { is_expected.to ... } really that much shorther than it { expect(subject).to ... }? ;)
<jhass> maybe read the next page first to better understand what we're talking about :D
<tsujp36> Ack
yokel has quit [Ping timeout: 240 seconds]
yokel has joined #ruby
cliluw has quit [Ping timeout: 265 seconds]
coniptor has quit [Ping timeout: 240 seconds]
<tsujp36> given that subject is calling let under the hood is subject now also lazily-evaluated the same as let?
yokel has quit [Ping timeout: 256 seconds]
<tsujp36> That is, my understanding of let is the following:
<tsujp36> (1) `let` does not set the implicit `subject`. (2) `let` does not allow expectations on the implicit `subject`. (3) `let` sets instance variables on an `example_group` for use between each `example`.
<tsujp36> Are these correct or is there a flaw in my understanding there?
<tsujp36> prefix that list with "let is the same as subject except for 1, 2, 3 ..."
yokel has joined #ruby
ur5us has joined #ruby
<Tuor> hi, I would like to copy a directory and all it's content as it is (ownership, permissions, links, if possible extended attributes and ACL) to a new path. I googled and found the rsync gem, but I can't find a way of copying directories, I can only copy files with it. Maybe I have to list all directories and files and create the new directories and then rsync every file. But I'm wondering, isn't there a simpler way? I could call the rsync binary and let it
<Tuor> do the job. What should I do?
robinimus has quit [Quit: Leaving.]
<jhass> tsujp36:I don't actually know. My comparision to let was functional and not based implementation details. With an as involved DSL as RSpec I would also abstain to model its behavior in terms of its implementation details. My persional expectation would be that subject is lazilily evaluated such as let (that's why subject! is a thing)
coniptor has joined #ruby
<jhass> but I don't think you're wrong anywhere
robinimus has joined #ruby
<jhass> Tuor: honestly, shelling out to rsync doesn't sound too bad here
<Tuor> OK. thx :)
<jhass> Tuor: fwiw that's what the rsync gem appears to be too, a thin wrapper around shelling out: https://github.com/jbussdieker/ruby-rsync/blob/master/lib/rsync/command.rb
robinimus has quit [Client Quit]
yokel has quit [Ping timeout: 272 seconds]
<jhass> also see line 12, it just hands off any arguments to rsync after prepending the --itemize-changes option
<jhass> so things like Rsync.run("-a", "b", "c") should work
jordanm has quit [Ping timeout: 240 seconds]
<jhass> so Rsync.run("src_dir", "dest_dir", %w(-a)) or so
jordanm has joined #ruby
kintarowonders has quit [Ping timeout: 244 seconds]
robinimus has joined #ruby
inkvar has joined #ruby
kintarowonders has joined #ruby
<Tuor> jhass: sounds like what I need. thx I'll see if I get it to work!
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
jinie has joined #ruby
<rapha> jhass: nakilon: sorry, this took a while. got an MWE now, I think: https://gist.github.com/sixtyfive/634d957bf1ef3814c69fdcad25264663
cnsvc has quit [Ping timeout: 240 seconds]
<Tuor> jhass: it's doing something. :) I'll have to wait for the result
<jhass> cool
<jhass> rapha: fyi hope your real code doesn't use var names like that :D also a underscore prefix is generally convention for "I don't care about this var"
<Guest51811> Hello, hope all are well... I'm a newbie migrating to ruby- I'm trying to figure out basic things like db migrations, configs etc. I'm using sinatra currently trying to set up migrations and db connections for different environments. I'm using rake to create db's, but eventho I'm setting environment to test for some reason development db is also created. here are my files https://hastebin.com/umiripipal.rb - thanks in advance for help
Guest51811 is now known as Ediz
<Ediz> any help is appreciated ^^
<jhass> rapha: new_tree[k] = new_tree.has_key?(k) ? Array(new_tree[k]) << _v : _v
yokel has joined #ruby
<jhass> ah wait, that doesn't handle joining the arrays
<jhass> [*new_tree[k], *_v]
<Tuor> jhass: What is the `&block` argument at https://github.com/jbussdieker/ruby-rsync/blob/master/lib/rsync.rb#L15 ?
<jhass> it captures the block, so some_method { this_is_the_block }
<jhass> the curly braces part goes into the var block
<jhass> in this case there's really no point to doing that though
<Tuor> ah ok.
<jhass> since instead the implicit block argument is invoked, using yield
<jhass> Ediz: somehow I doubt there's deep integration between activerecord and sinatra, so you're setting sinatra to the test env but that probably doesn't affect activerecord's configuration much
yokel has quit [Ping timeout: 256 seconds]
tsujp36 has quit [Remote host closed the connection]
coniptor has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #ruby
<jhass> and for development AR defaults to also creating the test db (it's meant for unit/integration tests)
<Ediz> ok... thank you. I need to look deeper to figure this out
kith has joined #ruby
Colpop4323 has joined #ruby
yokel has joined #ruby
Colpop4323 has quit [Remote host closed the connection]
<jhass> Ediz: gist is, use development for development, ignore test until you're writing unit or integration tests, set RACK_ENV=production when deploying, don't set the environment anywhere in code explicitly. Also no need to load you models for your migrations.
<Ediz> I'm aware :) just testing how things work depending on ENV on my local one by one to see them working
<Ediz> tyvm
zacts has joined #ruby
<rapha> jhass: oh! my own personal convention was always "if i'm walking a tree, then each _ in front of the variable name is one level further down". is there a convention for that, too?
<rapha> (but yes, these variable names were just for the MWE, the actual code has more descriptive ones)
alexherbo2 has quit [Ping timeout: 244 seconds]
<rapha> jhass: how do the asterisks in your code work / what are they? is it like in C?
roadt has quit [Ping timeout: 256 seconds]
mikecmpbll has joined #ruby
alexherbo2 has joined #ruby
<rapha> (Updated the code with your snippet: https://gist.github.com/sixtyfive/634d957bf1ef3814c69fdcad25264663 )
roadt has joined #ruby
Colpop4323 has joined #ruby
yokel has quit [Ping timeout: 260 seconds]
Colpop4323 has quit [Remote host closed the connection]
Colpop4323 has joined #ruby
ur5us has quit [Ping timeout: 244 seconds]
Colpop4323 has quit [Remote host closed the connection]
<rapha> jhass: seems the Array() isn't needed either. just [] is enough for it to work. even though i'm still puzzled at those asterisks.
Ediz has quit [Read error: Connection reset by peer]
Ediz has joined #ruby
Ediz is now known as Guest12825
<jhass> rapha: yeah, the [] was meant to replace the entire Array() << business. I'm not aware of a "one level deeper" convention, IME that represents different data anyhow and can have its own descriptive name, no need for some semi hungarian notation IMO
<jhass> rapha: * is splatting, it takes an array and transforms it into a comma separated list at syntax level
<jhass> if the argument is not array like, it's just kept as is
<jhass> it's the same thing you see in method calls
<jhass> &>> [*[1, 2], *(3..4), *5]
<rubydoc> # => [1, 2, 3, 4, 5] (https://carc.in/#/r/9ptf)
cliluw has joined #ruby
vondruch has quit [Ping timeout: 246 seconds]
Colpop4323 has joined #ruby
alexherbo2 has quit [Ping timeout: 260 seconds]
yokel has joined #ruby
Colpop4323 has quit [Remote host closed the connection]
greenbagels has quit [Ping timeout: 256 seconds]
yokel has quit [Ping timeout: 272 seconds]
ujjain2 has joined #ruby
<Guest12825> is rake coupled with rails?
Guest12825 is now known as Ediz
greenbagels has joined #ruby
robinimus has quit [Quit: Leaving.]
robinimus has joined #ruby
inkvar has quit [Quit: Textual IRC Client: www.textualapp.com]
elxbarbosa has joined #ruby
<jhass> Ediz: not in any way :)
<Ediz> documentation is talking about rails :p
<jhass> which one?
<Ediz> rake -D db:create
<jhass> well, that's the documentation for the rake task db:create, which is defined by activerecord, which while not being strictly coupled to it, is built in deep lockstep with the entire rails framework
<jhass> rake is just a generic task runner tool, pretty much anything can contribute tasks
<jhass> the name is pretty much a pun on make, think of it like that :)
<Ediz> right
<Ediz> well
<Ediz> I've not touched rails yet it was suprising to see it there
<Ediz> also not applying to my case since its using RACK_ENV
<Ediz> and not RAILS_ENV
<jhass> yeah, that's due to the integration code I linked earlier :)
yokel has joined #ruby
hiroaki has joined #ruby
yokel has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #ruby
robinimus1 has joined #ruby
robinimus has quit [Read error: Connection reset by peer]
ujjain2 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
robotmay has joined #ruby
kintarowonders has quit [Read error: Connection reset by peer]
kintarowonders has joined #ruby
zacts has quit [Quit: leaving]
yokel has joined #ruby
ujjain2 has joined #ruby
ujjain2 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yokel has quit [Ping timeout: 264 seconds]
dualfade has quit [Ping timeout: 265 seconds]
dualfade has joined #ruby
ellcs has joined #ruby
bsdbandit-01 has joined #ruby
bsdbandit-01 has quit [Max SendQ exceeded]
robinimus1 has quit [Quit: Leaving.]
robinimus has joined #ruby
bsdbandit-01 has joined #ruby
bsdbandit-01 has quit [Excess Flood]
bsdbandit-01 has joined #ruby
yokel has joined #ruby
ellcs has quit [Ping timeout: 240 seconds]
vondruch has joined #ruby
ujjain2 has joined #ruby
drincruz has joined #ruby
yokel has quit [Ping timeout: 256 seconds]
BSaboia has quit [Quit: This computer has gone to sleep]
zacts has joined #ruby
robinimus has left #ruby [#ruby]
roadt has quit [Ping timeout: 260 seconds]
cow[moo] has joined #ruby
meinside has quit [Quit: Connection closed for inactivity]
coniptor has joined #ruby
ellcs has joined #ruby
GodFather has quit [Ping timeout: 240 seconds]
TCZ has joined #ruby
yokel has joined #ruby
howdoi has joined #ruby
iNs has quit [Remote host closed the connection]
iNs has joined #ruby
<rapha> jhass: okay, got it (splatting - only knew a,b=[1,2] works so far)! as for the Array() thing, what i meant was that this here works, too: `new_tree[k] = new_tree.has_key?(k) ? [*new_tree[k], *vv] << vv : vv`
yokel has quit [Ping timeout: 246 seconds]
<jhass> rapha: drop the << vv, that would add a duplicate!
<jhass> a, b = foo I would call array decomposition :)
braincrash has joined #ruby
yokel has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
cliluw has quit [Ping timeout: 265 seconds]
cliluw has joined #ruby
yokel has quit [Ping timeout: 260 seconds]
strmpnk has left #ruby [#ruby]
bmurt has joined #ruby
SuperLag has joined #ruby
schne1der has quit [Quit: schne1der]
schne1der has joined #ruby
yokel has joined #ruby
zacts has quit [Quit: leaving]
wallace_mu has joined #ruby
roadt has joined #ruby
donofrio has joined #ruby
yokel has quit [Ping timeout: 246 seconds]
twodayslate has joined #ruby
yokel has joined #ruby
roadt has quit [Ping timeout: 260 seconds]
yokel has quit [Ping timeout: 260 seconds]
yokel has joined #ruby
Ediz has quit [Quit: Leaving]
GodFather has joined #ruby
vondruch has quit [Ping timeout: 240 seconds]
yokel has quit [Ping timeout: 258 seconds]
akem has quit [Ping timeout: 258 seconds]
x0n has quit [Ping timeout: 240 seconds]
x0n has joined #ruby
GodFather has quit [Ping timeout: 272 seconds]
BSaboia has joined #ruby
<elxbarbosa> it seems that ruby will become a lot more like python, all those "end" might not be needed in future versions :)
ChmEarl has joined #ruby
elxbarbosa has left #ruby ["ERC (IRC client for Emacs 27.1)"]
TCZ has quit [Quit: Leaving]
dfucci has quit [Ping timeout: 272 seconds]
BSaboia has quit [Quit: This computer has gone to sleep]
x0n has quit [Ping timeout: 265 seconds]
Colpop4323 has joined #ruby
yokel has joined #ruby
<apotheon> I'm not quite ready for Ruby to become like Python.
<jhass> we can always reenact the python 2/3 split and stay on Ruby 2 :D
Colpop4323 has quit [Remote host closed the connection]
<apotheon> okay
<apotheon> Actually, re-enact the Perl 5/6 split, and push Ruby 3 to rename itself, if it actually becomes like Python.
<apotheon> Then we could have a proper Ruby 3.
<jhass> Ruby 3xPi
<apotheon> Was Ruby's "endless" method syntax supposed to be only for one-line methods, or was that supposed to apply to multiline methods as well?
dfucci has joined #ruby
<jhass> last I heard for onliners
<apotheon> Yeah, if it's just for oneliners I think it's no skin off my nose.
<apotheon> If it's multiliners, too, I expect a lot of Ruby code to get *much* uglier.
dfucci has quit [Ping timeout: 256 seconds]
<jhass> I mean, there's \ and ;, heh
<jhass> makes me wonder if a; b counts as a single line in that context
yokel has quit [Ping timeout: 258 seconds]
dfucci has joined #ruby
akem has joined #ruby
yokel has joined #ruby
yokel has quit [Ping timeout: 264 seconds]
akem has quit [Quit: Leaving]
Asa has joined #ruby
Asa is now known as Guest51828
yokel has joined #ruby
cliluw has quit [Ping timeout: 272 seconds]
Guest51828 has quit [Ping timeout: 240 seconds]
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
Axy has quit [Ping timeout: 258 seconds]
znz_jp has quit [Remote host closed the connection]
<Tuor> Hi, this is my code right now: https://paste.ubuntu.com/p/cNHDnw8P9B/. On line 28 - 34 I create a list of disks. When line 30 is false, the disks array still gets an item added, but it is nil. How can I only add none nil item to the disks list?
yokel has quit [Ping timeout: 272 seconds]
znz_jp has joined #ruby
x0n has joined #ruby
<jhass> Tuor: best move the conditional into a select: snapshot.children(false).select {|child| ... match? }.map {|child| snapshot + child }
cd has joined #ruby
BSaboia has joined #ruby
yokel has joined #ruby
ellcs has quit [Ping timeout: 244 seconds]
ujjain2 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Dara has joined #ruby
cliluw has joined #ruby
braincrash has quit [Ping timeout: 246 seconds]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
coniptor has quit [Ping timeout: 256 seconds]
Mia has quit [Read error: Connection reset by peer]
x0n has quit [Ping timeout: 246 seconds]
yokel has quit [Ping timeout: 246 seconds]
coniptor has joined #ruby
<Tuor> jhass: ok works thank you!
<Tuor> will be able to use that in different place to. :)
cthu| has joined #ruby
<jhass> sure :) By time it's worth to read through https://rubyapi.org/2.7/o/enumerable, it's where a lot of Ruby's magic lives :)
ujjain2 has joined #ruby
twodayslate has quit [Quit: Connection closed for inactivity]
ramfjord has joined #ruby
yokel has joined #ruby
CrazyEddy has quit [Ping timeout: 244 seconds]
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
ramfjord has quit [Ping timeout: 260 seconds]
yokel has quit [Ping timeout: 256 seconds]
ramfjord has joined #ruby
schne1der has quit [Ping timeout: 246 seconds]
<Tuor> jhass: how do you like: https://dpaste.org/BPvW
<Tuor> I did once write a little ruby program and got a lot of help from this channel (thank you!) but it's some years ago and I didn't really use it since then. Did a lot of bash since then and some puppet... now I had a nice little project which makes more sense to write in an object oriented language then bash and finally I can write some ruby again! :)
<jhass> well, I prefer { } for blocks when chaining, but otherwise it's pretty much what I wrote, so I can't complain :D
<Tuor> Ah ok. Yes, I did put it into a method and now I'm calling it 2 times. less code :)
<Tuor> there are a lot of enumerable methods! wow
<havenwood> Tuor: They tend to be quite useful too. :)
<Tuor> I'm checking them out. Will for shure have to use them. :) thx!
mikecmpbll has quit [Quit: inabit. zz.]
Dara has quit [Remote host closed the connection]
dasher00 has quit [Ping timeout: 240 seconds]
ujjain2 has quit [Ping timeout: 260 seconds]
impermanence has quit [Ping timeout: 265 seconds]
ropeney_ has quit [Ping timeout: 240 seconds]
znz_jp has quit [Remote host closed the connection]
ropeney has joined #ruby
Milos has quit [Read error: Connection reset by peer]
Milos has joined #ruby
x0n has joined #ruby
ujjain2 has joined #ruby
ropeney_ has joined #ruby
ropeney has quit [Ping timeout: 246 seconds]
znz_jp has joined #ruby
x0n has quit [Ping timeout: 258 seconds]
chouhoulis has joined #ruby
troulouliou_div2 has joined #ruby
CrazyEddy has joined #ruby
neshpion has joined #ruby
x0n has joined #ruby
impermanence has joined #ruby
x0n has quit [Ping timeout: 260 seconds]
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
troulouliou_div2 has quit [Quit: Leaving]
x0n has joined #ruby
yokel has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
x0n has quit [Ping timeout: 265 seconds]
yokel has quit [Ping timeout: 260 seconds]
xco has quit [Quit: Textual IRC Client: www.textualapp.com]
Rounin has quit [Ping timeout: 260 seconds]
yokel has joined #ruby
m_antis has joined #ruby
x0n has joined #ruby
yokel has quit [Ping timeout: 260 seconds]
dfucci_ has joined #ruby
dfucci has quit [Ping timeout: 264 seconds]
Rounin has joined #ruby
dfucci_ has quit [Ping timeout: 256 seconds]
m_antis_ has joined #ruby
dionysus69 has quit [Remote host closed the connection]
yokel has joined #ruby
m_antis_ has quit [Client Quit]
dfucci has joined #ruby
x0n has quit [Ping timeout: 272 seconds]
m_antis has quit [Ping timeout: 258 seconds]
yokel has quit [Ping timeout: 256 seconds]
ujjain2 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yokel has joined #ruby
bocaneri has quit [Remote host closed the connection]
schne1der has joined #ruby
elcuervo has joined #ruby
rippa has joined #ruby
yokel has quit [Ping timeout: 260 seconds]
dfucci has quit [Ping timeout: 260 seconds]
dfucci has joined #ruby
adu has joined #ruby
dualfade has quit [Ping timeout: 272 seconds]
dualfade has joined #ruby
cnsvc has joined #ruby
gitter1234 has joined #ruby
yokel has joined #ruby
kith is now known as roadkith
dfucci has quit [Ping timeout: 272 seconds]
yokel has quit [Ping timeout: 272 seconds]
Rudd0 has quit [Ping timeout: 272 seconds]
adu has quit [Ping timeout: 240 seconds]
dasher00 has joined #ruby
ellcs has joined #ruby
dasher00 has quit [Client Quit]
yokel has joined #ruby
powerhouse has quit [Remote host closed the connection]
yokel has quit [Ping timeout: 272 seconds]
CrazyEddy has quit [Ping timeout: 240 seconds]
powerhouse has joined #ruby
Vingador has joined #ruby
CrazyEddy has joined #ruby
Vingador_ has quit [Ping timeout: 272 seconds]
yokel has joined #ruby
yokel has quit [Ping timeout: 265 seconds]
dfucci has joined #ruby
bruce_lee has quit [Remote host closed the connection]
x0n has joined #ruby
<ellcs> Hey, can someone explain me why `Integer === Integer` is false?
skape has quit [Quit: Connection closed for inactivity]
<jhass> ellcs: because Integer is not a subclass of Integer
<havenwood> &>> Class === Integer
<rubydoc> # => true (https://carc.in/#/r/9px4)
<jhass> &>> Integer === 1
<rubydoc> # => true (https://carc.in/#/r/9px5)
<havenwood> ellcs: Don't use threequals directly. It's to implement in classes you've created for case statement support and so on.
<jhass> ... or an instance of Integer
<ellcs> i understand the Integer === 1 operation. but i am a bit confused because i would like to case the type
akem has joined #ruby
<ellcs> case Integer; when Integer; puts 'hi'; end
<havenwood> ellcs: case 42; when Integer
<jhass> I doubt you'll have a literal Integer in the case, where is it coming from?
oncall-pokemon has quit [Quit: Connection closed for inactivity]
<havenwood> ellcs: Integer is a Class, not an instance of Integer itself.
<havenwood> ellcs: Show the code where you really want to case statement on Integer? Seems strange.
supercoven has quit [Ping timeout: 272 seconds]
<ellcs> ye, i upload it to pastebin
<ruby[bot]> ellcs: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<ellcs> msg is supposed to be the class/module
<jhass> why's this classes/modules over just constants?
<jhass> (with string or integer values)
<ellcs> because i want to pass integers and strings to further functions
<jhass> you mean you don't?
<ellcs> maybe i just expose the whole source code.
<jhass> good idea!
<ellcs> The method ProcessWorker#on_received_msg uses #special_message
<jhass> mmh, my question stays, why not module SpecialMessgaes; Stop = 0; Ack = 1; end
<jhass> okay well, I guess I have no clue what a not special message would look like
<ellcs> it could be anything
<jhass> (Marshal makes a bad RPC encoding btw)
<ellcs> also bad for ipc?
<ellcs> (i've been seeing this in parallel aswell)
yokel has joined #ruby
gix has joined #ruby
dead10cc has joined #ruby
<ellcs> well, i guess that i will just use Object#== instead of case
<ellcs> ¯\_(ツ)_/¯
<jhass> I guess
<jhass> the thing is, you need to take care the same code is available in both processes
<jhass> and ideally both run the same ruby version
<ellcs> i am using 2.7, there is supposed pattern matching now, right?
<ellcs> hmm, good point
<jhass> I think, didn't play with it. The syntax is case foo in stuff iirc
<jhass> so when -> in
<ellcs> i give it a try
yokel has quit [Ping timeout: 272 seconds]
<ellcs> so you would recommend not using those constants?
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<ellcs> or constants as classes or modules
Vingador has quit [Ping timeout: 272 seconds]
<jhass> I would look for simpler sentinel values
GodFather has joined #ruby
<ellcs> >>& case 0; in Integer; puts "hi"; end
<ruby[bot]> ellcs: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<ellcs> ah, wrong syntax, sorry for spam
<ellcs> &>> case 0; in Integer; puts "hi"; end
<rubydoc> # => hi... check link for more (https://carc.in/#/r/9px7)
<jhass> no worries
<ellcs> &>> case Integer; in Integer; puts "hi"; end
<rubydoc> stderr: -e:4: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!... check link for more (https://carc.in/#/r/9px8)
<jhass> I think personally I would limit the complexity of messages, enforce JSON or something
<jhass> but an approach that could keep what you want could to just containerize the whole stuff
<ellcs> my project idea was to write a simple parallel
<jhass> {kind: :payload, data: user_data} / {kind: :ack} / { kind: :stop }
<ellcs> just for studying
yokel has joined #ruby
<jhass> then write an API that just wraps/unwraps
<ellcs> i mean, since i fork the process i am pretty sure that it's the same ruby version
<ellcs> or do i get you wrong?
<jhass> nah
<jhass> I don't know, it just irks me somehow, I don't trust marshal :P
<ellcs> i get you
<ellcs> i am not sure if i would use this in production
Technodrome has quit [Remote host closed the connection]
yokel has quit [Ping timeout: 246 seconds]
<ellcs> thanks jhass
yokel has joined #ruby
dfucci has quit [Ping timeout: 260 seconds]
BSaboia has quit [Quit: This computer has gone to sleep]
yokel has quit [Ping timeout: 256 seconds]
braincrash has joined #ruby
skape has joined #ruby
ur5us has joined #ruby
yokel has joined #ruby
yokel has quit [Ping timeout: 260 seconds]
ellcs has quit [Ping timeout: 244 seconds]
ujjain2 has joined #ruby
dfucci has joined #ruby
yokel has joined #ruby
dfucci has quit [Ping timeout: 272 seconds]
ujjain2 has quit [Read error: Connection reset by peer]
CrazyEddy has quit [K-Lined]
yokel has quit [Ping timeout: 246 seconds]
akem_ has joined #ruby
akem has quit [Ping timeout: 260 seconds]
akem_ has quit [Quit: Leaving]
gitter1234 has quit [Quit: Connection closed for inactivity]
yokel has joined #ruby
<Tuor> baweaver: hi, just warched your talk about reducing enumerables. Thank you, I learned a lot! :)
ur5us has quit [Quit: Leaving]
ur5us has joined #ruby
yokel has quit [Ping timeout: 272 seconds]
bsdband0 has joined #ruby
bsdband0 has quit [Excess Flood]
Rudd0 has joined #ruby
bsdbandit-01 has quit [Ping timeout: 256 seconds]
reyfi9e has joined #ruby
yokel has joined #ruby
MarkPryor has joined #ruby
MarkPryor has quit [Read error: Connection reset by peer]
schne1der has quit [Ping timeout: 240 seconds]
imode has joined #ruby
yokel has quit [Ping timeout: 272 seconds]
braincrash has quit [Ping timeout: 256 seconds]
dfucci has joined #ruby
dfucci has quit [Ping timeout: 260 seconds]
BTRE has quit [Ping timeout: 272 seconds]
grant has joined #ruby
dead10cc has quit [Ping timeout: 240 seconds]
grant has quit [Quit: Konversation terminated!]
yokel has joined #ruby
impermanence has quit [Ping timeout: 265 seconds]
yokel has quit [Ping timeout: 260 seconds]
s2013 has joined #ruby
<s2013> this is a dumb questio but whats teh difference between 'return true' and 'return'
<havenwood> s2013: The latter returns `nil` and the former returns `true`.
<s2013> so if im trying to exit out of a method i can just use return right?
<havenwood> s2013: Yes, if you want to return early you can.
<s2013> thanks
jenrzzz has quit [Ping timeout: 265 seconds]
dionysus69 has joined #ruby
dionysus69 has quit [Ping timeout: 272 seconds]
lightstalker has joined #ruby
elxbarbosa has joined #ruby
yokel has joined #ruby
`Alison has quit [Ping timeout: 244 seconds]
yokel has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
graial has joined #ruby
<graial> test