<AstrallyForged>
`$stdin.readline` works when I give it no arguments, but hangs when I give it a string argument (and strace confirms that the read(2) is not returning).
<AstrallyForged>
I guess I could ignore `readline` and emulate it with `read` or `readpartial` but that's less convenient…
<AstrallyForged>
Any ideas what could be happening?
skuntee4 has joined #ruby
skuntee4 has quit [Ping timeout: 250 seconds]
<AstrallyForged>
Wait, readpartial is hanging too. :(
<joto>
What method can I use define this array as empty? E.g. return true if the array contains this nil value?
<joto>
can I use to define*
<joto>
both [nil].empty? and [nil].nil? return false...
<leftylink>
== is a method, so `[nil] == [nil]` would be a possibility. or perhaps `.all?(&:nil?)` would suit. or perhaps two methods, by using .compact.empty?
<joto>
thanks leftylink, I'm goign to try the last two as there can be multiple nil values in my array
<Guimauve>
i would suggest against defining a non-empty array as empty, as that would break other code that would expect something to actually be empty. instead of testing for emptiness... leftylink's .compact.empty? suggestion is safer.
<joto>
alright!
<joto>
argh, now I remember. I already checked .compact.empty? but I accidently did the following .compact!.empty?
<joto>
I was wondering why my array got destroyed LOL
<joto>
now I know. I shouldn't have used that exclamation mark
joto has quit [Ping timeout: 268 seconds]
ahayworth has quit [Remote host closed the connection]
joto has joined #ruby
<joto>
sorry, electricity broken again in my house
<joto>
I probably timed out
jpn has joined #ruby
jpn has quit [Ping timeout: 265 seconds]
idiocrash has quit [Ping timeout: 260 seconds]
<joto>
leftylink, Guimauve, extra complexity. The array I was talking about can also be nil itself
<joto>
I mean, it can also just not exist
<joto>
how would I chain the different methods in that case? would .nil?.compact.empty? work?
<joto>
or maybe the safe navigator
<joto>
&.compact.empty? <-- this one?
idiocrash has joined #ruby
<Guimauve>
joto - you could be lazy and do (thing || []).compact.empty? perhaps, if that works for your use-case. since nil is false.
<joto>
That actually looks elegant. It will definitly work for my use case
<joto>
thanks!
<Guimauve>
np. just a heads up, but most people seem to have moved to the ruby discord, so if you don't get what you need here, there are more people there to ask.
<joto>
yes I realize but I'm a bit nostalgic
<Guimauve>
heh
<joto>
I don't really like the childish theme of dicord
<Guimauve>
^_^b
<joto>
the native feel of my IRC client against the sluggish discord interface
<joto>
but you're right, if it's too quiet here, I can always ask my questions over there
<joto>
glad you answered in a timely fashion :p
<Guimauve>
does discord use electron now?
<joto>
I think so. at least it feels like that
<joto>
the interface is very webby at least
<Guimauve>
they do indeed use electron it looks like
<joto>
yep
<Guimauve>
built with electron and react... huh.
<joto>
-_-
<joto>
react is okay but not for the whole interface