<kyrylo>
What's up guys. Is there any way to tell if a thread is sleeping or being stopped? On Ruby 2.4 a stopped thread returns `sleep_forever` but on Ruby 2.3 it's just `sleep`. That said, on Ruby 2.4 the status would still be 'sleep' https://gist.github.com/kyrylo/b70862a458345573f44dbfa58214dce3
chunkypuffs has joined #ruby
ur5us has quit []
eclm has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
donofrio has quit [Remote host closed the connection]
xco has quit [Quit: xco]
donofrio has joined #ruby
<kyrylo>
Thread.stop? would return true for both cases, so no
<dionysus69>
NL3limin4t0r: ok my bad, it works with the string :\ I missed something with my testing
<kyrylo>
The workaround I use is the stop variable. So before I call Thread.stop, I just assign @stop = true and then stop my thread. After the thread resumes, I call @stop = false
<NL3limin4t0r>
What is the use-case? If you're gonna speep a thread forrever isn't it better to simply exit the thread?
MrCrackPotBob has quit [Remote host closed the connection]
MrCrackPotBob has joined #ruby
<kyrylo>
I don't want to exit because it's expensive for my use case (I would need to respawn that thread every 15 seconds). I just want to have one thread that works like a timer but never exits
mcspud has quit [Excess Flood]
agrecascino has quit [Ping timeout: 245 seconds]
agrecascino has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mcspud has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4351 is now known as AJA4350
chunkypuffs has joined #ruby
BH23 has joined #ruby
blackmesa has joined #ruby
fuzzface has joined #ruby
stryek has joined #ruby
BTRE has quit [Remote host closed the connection]
ellcs has quit [Ping timeout: 268 seconds]
queip has quit [Ping timeout: 268 seconds]
blackmesa has quit [Ping timeout: 276 seconds]
lucasb has joined #ruby
queip has joined #ruby
raul782 has joined #ruby
raul782 has quit [Remote host closed the connection]
raul782 has joined #ruby
chalkmonster has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
jrafanie has joined #ruby
greengriminal has joined #ruby
raul782 has quit [Remote host closed the connection]
grilix has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4351 is now known as AJA4350
banisterfiend has joined #ruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
x86sk has quit [Quit: Connection closed for inactivity]
rbanffy has joined #ruby
codefriar has joined #ruby
jrafanie has joined #ruby
jrafanie has quit [Client Quit]
AJA4351 has joined #ruby
mre- has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
fuzzface has quit [Quit: Leaving]
osieln has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.6]
Fernando-Basso has quit [Ping timeout: 265 seconds]
rippa has joined #ruby
codefriar has quit [Ping timeout: 276 seconds]
codefriar has joined #ruby
Fernando-Basso has joined #ruby
queip has quit [Ping timeout: 245 seconds]
drincruz has joined #ruby
xco has quit [Quit: xco]
queip has joined #ruby
Fischmiep has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]
hiroaki has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
xco has joined #ruby
Fischmiep has quit [Ping timeout: 240 seconds]
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
ur5us has quit [Remote host closed the connection]
mre- has quit [Ping timeout: 240 seconds]
yann-kaelig has joined #ruby
cnsvc has quit [Remote host closed the connection]
cnsvc has joined #ruby
rapha has joined #ruby
<rapha>
hi
rbanffy has quit [Quit: rbanffy]
<phaul>
hi rapha
TomyWork has quit [Remote host closed the connection]
<rapha>
with minitest, when i run a file containing a class deriving from Minitest::Test and using 'minitest/autorun', is there any way to hand in a piece of information from the command line?
<rapha>
(just one string ... two characters only, in fact)
SeepingN has joined #ruby
<adam12>
rapha: How are you running the test file?
<rapha>
well, since i found out about "--pride", i'm adding that, too, because who doesn't like pretty colours in a terminal
<adam12>
rapha: Are they not available on ARGV?
<rapha>
OH!OH!
<rapha>
it just ignores any further arguments
<adam12>
rapha: I don't believe minitest will mangle ARGV, unless you are using minitest-sprint (which has it's own opt parser IIRC).
<rapha>
thank you adam12 :-D
greengriminal has joined #ruby
<adam12>
rapha: yw
DTZUZO has joined #ruby
elphe has joined #ruby
<rapha>
!!!!
* rapha
just learned about [3].[](0) and then about [3]&.[](0) and then about nil&.[](0) and now has a hole in his brain the size of a sniper rifle bullet
queip has quit [Ping timeout: 240 seconds]
DTZUZO has quit [Ping timeout: 265 seconds]
<adam12>
Yikes.
<rapha>
:-P
<adam12>
Hopefully as examples of what not to write.
<rapha>
more like as examples of how many sadistic ways of prodding his coworkers my coworker knows
queip has joined #ruby
Intelo has quit [Remote host closed the connection]
zapata has joined #ruby
xco has quit [Quit: xco]
<rapha>
also [1]&[2], okay. BUT nil&[0] - WTF!
<rapha>
AND: [5]&.[0] doesn't work at all. might have, but doesn't. only [5]&.[](0) does.
RougeRR has joined #ruby
chalkmonster has joined #ruby
<RougeRR>
hi
<phaul>
idk but those aren;t surprising to me at all
<phaul>
works exactly how I would expect it to
<phaul>
but & is the & method, where as &. is a syntax for save navigation operator
<rapha>
lololol
<rapha>
okay try this:
<rapha>
open pry
rbanffy has joined #ruby
<rapha>
type: def Array;end
<RougeRR>
is there a way of doing this as one statement
<RougeRR>
tried looking at array interesections etc
xco has joined #ruby
<phaul>
RougeRR: why can't you lose the @drm.length > 1 part?
<phaul>
isn't the include something that already implies it?
<RougeRR>
because i want to do something else if there are more drm providers or zero
<phaul>
nvm for some reason i thought >=
<RougeRR>
i only want this to be true if it equals ['aes] and is not an empty array
mre- has joined #ruby
<phaul>
but that's not what you have there . not empty would be >= and then it would be implied by the include?
AJA4351 has joined #ruby
<RougeRR>
@drm != ['aes'] && @drm.any?
<RougeRR>
is the same
<RougeRR>
i just cant find a way to not use &&
<phaul>
in other words if @drm.include('aes') is true then @drm can't be empty
<RougeRR>
no
<rapha>
phaul: you're too knowledgable to be surprised by these, I understand. To me it's just funny/funky/interesting because it's mind-blowing in a way.
<RougeRR>
its saying
<RougeRR>
only set this variable to true. if 'aes' is the only item in the array
<RougeRR>
and the array is not empty
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
<phaul>
then @apply_encryption = @drm == ['aes']
<RougeRR>
wait ugh i explained that wrong
conta2 has joined #ruby
<RougeRR>
im sorry
<RougeRR>
Only set this variable to true, if aes is present in the array and there are more items in the array and the array is not empty
<RougeRR>
so ['aes', 'fairplay'] would be true
<RougeRR>
['aes'] would not
<RougeRR>
[] would not
dhollinger has joined #ruby
mre- has quit [Ping timeout: 245 seconds]
<phaul>
then I would settle with your original code :)
<RougeRR>
yeah, i cant see another way of doing it lol
<RougeRR>
i just know my boss will kick up a fuss...its legacy im building on top of
<phaul>
can you transfer some of the logic into priv methods? that might help readablity
<RougeRR>
not really for this to be honest. Its doable, but i know it wont be accepted
<RougeRR>
its okay phaul i'll see if there is another way
<RougeRR>
i just wanted to check i couldnt do that without a &&
renich has joined #ruby
Obats has joined #ruby
<RougeRR>
thanks for help
<phaul>
RougeRR: np. sorry we couldn't give any better suggestion
<RougeRR>
its okay, that was helpful. I was not sure if it was possible
RougeRR has quit [Quit: Leaving]
conta2 has quit [Ping timeout: 265 seconds]
DTZUZO has joined #ruby
<Obats>
Ruby newbie here. Is it not allowed to do multiple calls to open()? They *do* close immediately, right? I have one open() that loads a webpage that holds a list. The list items are then extracted and I want to open() the pages that the list items link to. But even though I copied the open() from the first line the second open() line seems to fail..
<phaul>
rapha: It's useful to realize that everything is a method call. If the receiver is not visible then it's implicitly self. 1 + 2 is the same as 1.+(2) . &. is just a syntactic addition for checking nil. puts 'hello' is a method call and it's the same as self.puts 'hello'
schne1der has quit [Ping timeout: 240 seconds]
<phaul>
Obats: can you share the code with us? Also how does it fail?
<Obats>
phaul: I don't know. No messages at least, would love to know how to check that better. All I know right now is that if I uncomment the course_html assignment line I no longer get anything in the file.
<phaul>
normally all the usual methods are defined in Kernel (module) which is then included by Object, so those methods work everywhere just by inheritance. But you can inherit BasicObject, that doesn't have kernel:
<phaul>
&>> class X < BasicObject; def foo; puts 'hi'; end; end; X.new.foo
<rubydoc>
stderr: -e:2:in `foo': undefined method `puts' for #<X:0x00005614d93e6d10> (NoMethodError)... check link for more (https://carc.in/#/r/7ng2)
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
etupat has quit [Remote host closed the connection]
fphilipe has quit [Ping timeout: 276 seconds]
etupat has joined #ruby
smurfendrek123_ has joined #ruby
etupat has quit [Remote host closed the connection]
chalkmonster has quit [Quit: WeeChat 2.6]
etupat has joined #ruby
mre- has quit [Ping timeout: 265 seconds]
jrafanie has joined #ruby
queip has quit [Ping timeout: 240 seconds]
queip has joined #ruby
mre- has joined #ruby
BH23 has quit [Ping timeout: 264 seconds]
Technodrome has joined #ruby
mre- has quit [Ping timeout: 245 seconds]
Intelo has joined #ruby
john2496 has joined #ruby
RougeRRR has joined #ruby
<RougeRRR>
phaul, just wanted to let you know me and my manager had a discussion together and came up with a somewhat more elegant solution
<NL3limin4t0r>
If you don't mind using the set std-lib.
<RougeRRR>
possibly....let me have a look. thanks for input
MrCrackPot has joined #ruby
<NL3limin4t0r>
If you have no objection to using set you could also replace `(%w[aes fairplay] - @drm).empty?` with `@drm.to_set >= Set['aes', 'fairplay']`.
<RougeRRR>
I could do yeah. im just looking i dont think we have Set required
orbyt_ has joined #ruby
troulouliou_dev has joined #ruby
troulouliou_dev has quit [Remote host closed the connection]
freedom has joined #ruby
AJA4351 has joined #ruby
renich has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<NL3limin4t0r>
I personally like set comparisons. `@drm.to_set > Set['aes']` clearly states that @drm must contain more than only "aes", but I understand if you you don't want to require new libraries.
<RougeRRR>
nono i like set comparisons too
<RougeRRR>
i hadnt thought of doing it that way
<RougeRRR>
but yeah, i dont think it iwll get through code review
etupat has joined #ruby
blackmesa has joined #ruby
fphilipe has quit [Ping timeout: 246 seconds]
impermanence has joined #ruby
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
freedom has quit [Quit: freedom]
freedom has joined #ruby
<NL3limin4t0r>
Why don't you expect it to get through? Because of the additional requirement?
<RougeRRR>
NL3limin4t0r, hmmm
<RougeRRR>
Set is in scope
<RougeRRR>
as in we have it required
<RougeRRR>
i wasnt sure if we did
<NL3limin4t0r>
Keep in mind that #to_set removes duplicates, but I assumed that they aren't in the array.
raul782 has joined #ruby
<RougeRRR>
there will be no duplicates correct
<NL3limin4t0r>
So the behaviour is not exactly the same.
<NL3limin4t0r>
seems correct and has only differing behaviour in the case that @drm can contain duplicates. For example @drm = %w[aes aes] has a different output.
<RougeRRR>
yeah
<RougeRRR>
if the use included dups
<RougeRRR>
then thats their problem
<RougeRRR>
or we should be validating elsewhere
<havenwood>
@drm.uniq.size > 1
<havenwood>
totally depends if dups *should* be ignored
<havenwood>
You I like Set.
<havenwood>
>.> Oops, I meant: I like Set.
<RougeRRR>
for this use case im not concerned about dupicates
nowhere_man has quit [Ping timeout: 276 seconds]
<RougeRRR>
im just looking how using set would integreate in
<NL3limin4t0r>
If @drm is under your control you could also make it a set to begin with. Then you can even leave out the #to_set call.
<RougeRRR>
yeah its not under out control alas
<havenwood>
RougeRRR: Can it just be a Set to begin with?
<RougeRRR>
noo
<havenwood>
NL3limin4t0r: haha, beat me to it
<RougeRRR>
its got lots of other places to go ;)
<RougeRRR>
and it needs to be an array to visit them
pdub has joined #ruby
<RougeRRR>
its going in and out of a parser for starters
<RougeRRR>
which would just die if it saw a set haha
chalkmonster has joined #ruby
pdub has quit [Remote host closed the connection]
<havenwood>
RougeRRR: it'll always be an Array of Strings?
<RougeRRR>
yeah
<NL3limin4t0r>
You can always convert it back to an array with the #to_a call which is less intensive then #to_set, however if you don't control the creation of @drm this isn't worth discussing to begin with.
pdub has joined #ruby
queip has joined #ruby
<RougeRRR>
NL3limin4t0r, no we dont. its input from the user at api
<RougeRRR>
sure i could change it then
<RougeRRR>
but, yeah its not really an option worth considering
<RougeRRR>
this drm array is used in a lot of different places
<NL3limin4t0r>
Then I wouldn't change it.
<NL3limin4t0r>
But you can still #to_set in the comparison.
<RougeRRR>
indeed i can
<RougeRRR>
ill write it down in a branch
MrCrackPot has quit [Ping timeout: 276 seconds]
<RougeRRR>
and put it to boss
<RougeRRR>
just knocking it up now
etupat has quit [Ping timeout: 240 seconds]
pdub has quit [Remote host closed the connection]
<NL3limin4t0r>
havenwood: great minds think alike =p
etupat has joined #ruby
<NL3limin4t0r>
although I feel like you're the more knowledgeble here
etupat has quit [Remote host closed the connection]
xco has joined #ruby
r29v has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yann-kaelig has quit [Quit: yann-kaelig]
elphe has joined #ruby
r29v has quit [Client Quit]
elphe has quit [Ping timeout: 276 seconds]
fphilipe has quit [Ping timeout: 276 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
raul782 has joined #ruby
xco has quit [Quit: xco]
etupat has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
drincruz has quit [Read error: Connection reset by peer]
drincruz has joined #ruby
etupat has quit [Remote host closed the connection]
queip has quit [Ping timeout: 240 seconds]
duderono_ has quit [Read error: Connection reset by peer]
duderonomy has joined #ruby
queip has joined #ruby
duderonomy is now known as Guest23590
deathwishdave has joined #ruby
Guest23590 has quit [Read error: Connection reset by peer]
cd has joined #ruby
duderono_ has joined #ruby
duderono_ has quit [Read error: Connection reset by peer]
duderono_ has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yasumi2136_ has joined #ruby
duderono_ has quit [Read error: Connection reset by peer]
duderono_ has joined #ruby
yasumi2136 has quit [Ping timeout: 265 seconds]
deathwishdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
m27frogy has quit [Ping timeout: 245 seconds]
Technodrome has joined #ruby
chalkmonster has joined #ruby
m27frogy has joined #ruby
duderono_ has quit [Read error: Connection reset by peer]
duderono_ has joined #ruby
blackmesa1 has joined #ruby
blackmesa has quit [Ping timeout: 245 seconds]
duderono_ has quit [Read error: Connection reset by peer]
duderono_ has joined #ruby
xco has joined #ruby
mre- has quit [Ping timeout: 268 seconds]
jenrzzz has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
duderono_ has quit [Read error: Connection reset by peer]
duderono_ has joined #ruby
mre- has joined #ruby
Intelo has joined #ruby
drincruz has quit [Read error: No route to host]
drincruz_ has joined #ruby
bambanx has joined #ruby
frem has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4350 has joined #ruby
iNs has quit [Remote host closed the connection]
iNs has joined #ruby
xco has quit [Quit: xco]
jenrzzz has quit [Ping timeout: 276 seconds]
orbyt_ has joined #ruby
heavendestroyer has joined #ruby
madhatter has quit [Remote host closed the connection]
madhatter has joined #ruby
heavendestroyer has left #ruby [#ruby]
elphe has joined #ruby
john2496 has quit [Remote host closed the connection]
hutch1 has quit [Ping timeout: 252 seconds]
elphe has quit [Ping timeout: 245 seconds]
houhoulis has joined #ruby
Bish has quit [Disconnected by services]
queip has quit [Ping timeout: 265 seconds]
renich has quit [Quit: renich]
renich has joined #ruby
fphilipe has joined #ruby
queip has joined #ruby
mre- has quit [Ping timeout: 240 seconds]
grilix has quit [Ping timeout: 265 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
duderono_ has quit [Read error: Connection reset by peer]
duderonomy has joined #ruby
duderonomy is now known as Guest84749
tfitts has joined #ruby
houhoulis has quit [Remote host closed the connection]
greengriminal has joined #ruby
AJA4351 has joined #ruby
hightower3 has joined #ruby
hightower2 has quit [Ping timeout: 276 seconds]
fig-le-deunch has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
fig-le-deunch has quit [Client Quit]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest84749 has quit [Read error: Connection reset by peer]
duderono_ has joined #ruby
duderono_ has quit [Read error: Connection reset by peer]
duderono_ has joined #ruby
Intelo has quit [Read error: Connection reset by peer]
fphilipe has quit [Ping timeout: 245 seconds]
Intelo has joined #ruby
jenrzzz has joined #ruby
elphe has joined #ruby
wildtrees has quit [Quit: Leaving]
ramfjord has quit [Ping timeout: 240 seconds]
elphe has quit [Ping timeout: 240 seconds]
drincruz_ has quit [Ping timeout: 240 seconds]
ramfjord has joined #ruby
davor has quit [Ping timeout: 276 seconds]
DaRock has joined #ruby
davor has joined #ruby
yokel has quit [Ping timeout: 240 seconds]
yokel has joined #ruby
schne1der has quit [Ping timeout: 276 seconds]
uranoss has joined #ruby
dhollinger has quit [Quit: dhollinger]
leitz has joined #ruby
gnufr33d0m has quit [Quit: gnufr33d0m]
<leitz>
I've been travelling for a few days, and just saw a reference to the Chef-Sugar issue. Is there more to it than "Open Source developer didn't like how his code was being used"?
fphilipe has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
Intelo has quit [Ping timeout: 276 seconds]
mre- has joined #ruby
Intelo has joined #ruby
rbanffy has quit [Quit: rbanffy]
rbanffy has joined #ruby
rbanffy has quit [Client Quit]
al2o3-cr has quit [Ping timeout: 246 seconds]
Intelo has quit [Remote host closed the connection]
Intelo has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
Intelo has quit [Remote host closed the connection]
Intelo has joined #ruby
rbanffy has joined #ruby
Intelo has quit [Remote host closed the connection]
Intelo has joined #ruby
freedom has joined #ruby
i9zO5AP has joined #ruby
hightower3 has quit [Ping timeout: 240 seconds]
nahra has joined #ruby
Ai9zO5AP has quit [Ping timeout: 240 seconds]
Intelo has quit [Remote host closed the connection]