jhass[m] changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.2, 3.0.4, 2.7.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
kaivai has joined #ruby
markong has quit [Ping timeout: 268 seconds]
jl- has quit [Ping timeout: 260 seconds]
<adam12> musashi: That's one thing I like about Unpoly. Built in modals :P
Thanzex5 has joined #ruby
Thanzex has quit [Ping timeout: 264 seconds]
Thanzex5 is now known as Thanzex
crankharder has joined #ruby
<arfy> hmmm. can someone point me in the right direction here? I had a script that I wrote under ruby 2.5.1, which used the form "processing #file". When I picked up the script again recently under ruby's 2.6.8 and 3.12, that syntax didn't work. so when was that form of string interpolation removed?
<arfy> now only "processing #{file} works"
jhawthorn has quit [Quit: ZNC 1.8.2 - https://znc.in]
jhawthorn has joined #ruby
jpn has joined #ruby
aeris has quit [Remote host closed the connection]
aeris has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
incal has joined #ruby
<incal> o/ how would you guys define the key things with Ruby in a one-liner? e.g. for this file, https://dataswamp.org/~incal/COMP-HIST
<incal> which is used by this script https://dataswamp.org/~incal/sth/scripts/hist which is used by this bot https://dataswamp.org/~incal/#sth ...
<incal> I read on the Wikipedia page but it was so much general-purpose and multi-paradigm couldn't really get an idea what it was all about
nirvdrum has quit [Quit: nirvdrum]
<llua> general multi purpose paradigm
<weaksauce> arfy i can't imagine that ever working... huh looks like you can do it with #@file
<weaksauce> odd
<arfy> weaksauce: It used to be that #file would work if file was a simple variable reference.
<arfy> or rather, filename.
<weaksauce> have you tried running it under like 1.8 or 1.9
IsoLinCHiP has quit [Ping timeout: 240 seconds]
<arfy> weaksauce: no need, #{file} works fine, I was just curious when the change happen.
onyx has quit [Read error: Connection reset by peer]
IsoLinCHiP has joined #ruby
arfy has quit [Remote host closed the connection]
Rounin has quit [Ping timeout: 240 seconds]
nirvdrum has joined #ruby
crankharder has quit [Ping timeout: 268 seconds]
Ziyan has joined #ruby
arfy has joined #ruby
IsoLinCHiP has quit [Ping timeout: 264 seconds]
IsoLinCHiP has joined #ruby
aeris has quit [Remote host closed the connection]
IsoLinCHiP has quit [Ping timeout: 255 seconds]
IsoLinCHiP has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
Ziyan has quit [Ping timeout: 244 seconds]
Ziyan has joined #ruby
reset has quit [Quit: reset]
jl- has joined #ruby
jl- has quit [Ping timeout: 276 seconds]
mitt3ns is now known as agent_white
taiju has joined #ruby
moldorcoder7 has quit [Ping timeout: 268 seconds]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
IsoLinCHiP has quit [Ping timeout: 244 seconds]
IsoLinCHiP has joined #ruby
_ht has joined #ruby
Linux_Kerio has joined #ruby
dannyAAM has quit [Remote host closed the connection]
IsoLinCHiP has quit [Ping timeout: 272 seconds]
dannyAAM has joined #ruby
taiju has quit [Ping timeout: 240 seconds]
IsoLinCHiP has joined #ruby
gr33n7007h has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
taiju has joined #ruby
shokohsc has quit [Quit: The Lounge - https://thelounge.chat]
shokohsc has joined #ruby
jl- has joined #ruby
teclator has joined #ruby
jl- has quit [Ping timeout: 268 seconds]
Ziyan has quit [Ping timeout: 244 seconds]
Ziyan has joined #ruby
Ziyan has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
taiju has quit [Quit: rcirc on GNU Emacs 28.1]
ur5us has joined #ruby
dangerousdave has joined #ruby
Ziyan has joined #ruby
infinityfye has joined #ruby
dionysus69 has joined #ruby
jl- has joined #ruby
jl- has quit [Ping timeout: 268 seconds]
dangerousdave has quit [Quit: Textual IRC Client: www.textualapp.com]
brw3 has joined #ruby
Ziyan_ has joined #ruby
brw has quit [Ping timeout: 255 seconds]
brw3 is now known as brw
Ziyan has quit [Ping timeout: 272 seconds]
entropie has quit [Ping timeout: 244 seconds]
entropy has joined #ruby
entropy is now known as entropie
taiju has joined #ruby
jpn has joined #ruby
brw has quit [Quit: Ping timeout (120 seconds)]
brw has joined #ruby
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp- has joined #ruby
Sankalp- is now known as Sankalp
brw has quit [Quit: Ping timeout (120 seconds)]
brw has joined #ruby
Ziyan has joined #ruby
Ziyan_ has quit [Ping timeout: 244 seconds]
Rounin has joined #ruby
Sankalp has quit [Ping timeout: 272 seconds]
jpn has quit [Ping timeout: 268 seconds]
desnudopenguino has quit [Read error: Connection reset by peer]
desnudopenguino has joined #ruby
TomyWork has joined #ruby
jpn has joined #ruby
desnudopenguino has quit [Read error: Connection reset by peer]
desnudopenguino has joined #ruby
taiju has quit [Ping timeout: 255 seconds]
Mikaela has quit [Remote host closed the connection]
jpn has quit [Ping timeout: 240 seconds]
jl- has joined #ruby
jl- has quit [Ping timeout: 276 seconds]
moldorcoder7 has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 244 seconds]
jpn has joined #ruby
markong has joined #ruby
crankharder has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
crankharder has quit [Ping timeout: 244 seconds]
nirvdrum has joined #ruby
infinityfye has quit [Quit: Leaving]
Zerock has joined #ruby
<Zerock> Where can I find all the methods of the Socket class? I see the official documentation, but the example code lists a "puts" method that doesn't appear in the doc. I'm tried looking in super- and subclasses to no avail. I assume it's mixing in a module, but it isn't clear which one.
<Zerock> My actual goal is to figure out whether a socket has data to receive. I want to check whether I need to process something without blocking the thread.
<jhass[m]> Zerock: Socket < BasicSocket and BasicSocket < IO, which is where put's is coming from. To get a true total list I like to just fire up a REPL (irb, pry), get an instance of the object and looks at .methods.sort or so
<Zerock> oh somehow I missed IO
<Zerock> and yes, .methods would work but I wanted to read a description as well
<Zerock> Thanks for that. Do you happen to also know the answer to my specific socket question? .recvfrom_nonblock looks promising but it's not entirely clear to me how it works
<Zerock> ideally there would be something to just return a boolean for whether there is coming data
<jhass[m]> .method(:something).owner usually gives you the type it's coming from
<jhass[m]> I'd probably try IO#read_nonblock
taiju has joined #ruby
<jhass[m]> Maybe you have some luck with IO#ready?
<jhass[m]> but IME it's all very hit and miss
<Zerock> hmmm, I see example code under read_nonblock for using .select to wait for data
<Zerock> I'll look at ready
<jhass[m]> safest probably is to just have a seperate thread reading your socket in a busy loop, do some basic message splitting and push events to a Queue which your main thread listens to
<Zerock> jhass[m]: That is the plan once my connection is fully established. I was hoping to keep it simple for the initial handshake sequence.
<Zerock> but yeah maybe I just need to jump straight into the loop
<jhass[m]> because behavior of all of this changes between the underlying thing being a TCP socket, UDP socket, File handle, Pipe, Block device etc. and then if opened with O_NONBLOCK or not, using event APIs or regular stuff and so on
<jhass[m]> my point is doing a coherent IO abstraction is basically impossible
<Zerock> well luckily in my case this application will only use TCP sockets, so it would at least be consistent in that respect
jl- has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
protektwar has quit [Client Quit]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
jpn has joined #ruby
jl- has quit [Ping timeout: 272 seconds]
Ziyan_ has joined #ruby
<Zerock> One unrelated thing... I know I can turn a method into a block using something like &method(:my_method) if the method is in the current scope. How would I do a similar contruct if the method is a member of some other module or class?
Ziyan has quit [Ping timeout: 268 seconds]
Mikaela has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
<jhass[m]> it works for "current scope" because it's just a method call, so think foo(&self.method(:my_method)); or to be even more verbose method_obj = self.method(:my_method); foo(&method_obj)
<jhass[m]> Now you're in no way limited to calling method on self only, you can call it on any scope
<jhass[m]> er, object
<Zerock> And this works for modules as well?
<jhass[m]> kinda yes
<Zerock> neat
<jhass[m]> all methods in Ruby are actually instance methods, so you need always some object, some "self" for the method to run with
<Zerock> right, but modules have a self
<jhass[m]> .method takes care of this by binding the object it's called itself upon to the returned method object
<jhass[m]> so if you're talking about an instance method in a module, you'll need to call it on some object (=instance of some class) that has the module included
<Zerock> that makes sense
<Zerock> I just ran a quick test and it's behaving as I'd expect. Thanks. :)
<jhass[m]> if you're talking about a "class method"/"module function"/"singleton method", something you'd regularly call as MyModule.my_method, MyModule.method(:my_method) works fine because there the object is the instance of Module assigned to the constant MyModule
jpn has joined #ruby
<Zerock> right, yep
<jhass[m]> cool, cheers
<Zerock> call .method of whatever object I need it from, and that object might be a class or module itself
_aeris_ has joined #ruby
taiju[m] has joined #ruby
Ziyan_ has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
crankharder has joined #ruby
Ziyan has joined #ruby
crankharder has quit [Ping timeout: 268 seconds]
Thanzex5 has joined #ruby
Thanzex has quit [Ping timeout: 240 seconds]
Thanzex5 is now known as Thanzex
incal has left #ruby [ERC 5.4.1 (IRC client for GNU Emacs 29.0.50)]
jpn has quit [Ping timeout: 268 seconds]
moldorcoder7 has quit [Ping timeout: 268 seconds]
moldorcoder7 has joined #ruby
Mikaela is now known as Aminda
lus3Rz has joined #ruby
lus3Rz has quit [Remote host closed the connection]
lus3Rz has joined #ruby
crankharder has joined #ruby
lus3Rz has quit [Remote host closed the connection]
jpn has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
crankharder has quit [Quit: leaving]
Ziyan_ has joined #ruby
Ziyan has quit [Ping timeout: 272 seconds]
jpn has joined #ruby
protektwar has quit [Ping timeout: 255 seconds]
jpn has quit [Ping timeout: 268 seconds]
bit4bit has joined #ruby
jpn has joined #ruby
jl- has joined #ruby
Thanzex has quit [Ping timeout: 268 seconds]
jl- has quit [Ping timeout: 240 seconds]
<Zerock> I'm trying to add an exception handler for SIGINT. I see that it causes an Interrupt, but when I try to rescue Interrupt, it doesn't seem to actually capture it. I see that I can handle it using trap(), but I want to be able to access some local variables in my handler. what's going on?
sgt_chuckles has joined #ruby
taiju has quit [Ping timeout: 240 seconds]
<Zerock> oh, I've got it. If I try to do with by just writing a test block into stdin of ruby, it doesn't work, but if it's in a file, it does
Aminda has quit [Ping timeout: 268 seconds]
Aminda has joined #ruby
<sgt_chuckles> I have an rspec with multiple repetitive definitions I want to condense into a single reusable function.
<sgt_chuckles> thing is, the difference with each of these repetitive blocks is the object which uses a different method for each definition
<sgt_chuckles> wondering if theres a way to somehow pass a function to it???
<sgt_chuckles> here's my code: https://bpa.st/U7IQ
reset has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
<jhass[m]> sgt_chuckles: I'd probably just script it tbh 🙈 https://p.jhass.eu/bx.rb
nirvdrum has quit [Read error: Connection reset by peer]
___nick___ has joined #ruby
<sgt_chuckles> jhass[m]: how would I include the tag filtering in this case?
<jhass[m]> well it's all just Ruby. describe(..., local: some_condition)
<jhass[m]> Could [..].include?(type), or iterate through {foo: {tags: {}} or whatever
sgt_chuckles has quit [Quit: Client closed]
sgt_chuckles has joined #ruby
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
sgt_chuckles has quit [Quit: Client closed]
sgt_chuckles has joined #ruby
arfy8820 has joined #ruby
arfy has quit [Ping timeout: 240 seconds]
arfy8820 is now known as arfy
samic2004 has joined #ruby
Aminda has quit [Remote host closed the connection]
jl- has joined #ruby
Aminda has joined #ruby
justtryingirc has joined #ruby
nirvdrum has joined #ruby
jl- has quit [Ping timeout: 240 seconds]
justtryingirc has quit [Quit: Igloo IRC: https://iglooirc.com]
justtryingirc has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
Ziyan_ has quit [Ping timeout: 264 seconds]
justtryingirc has quit [Client Quit]
Ziyan has joined #ruby
Ziyan has quit [Ping timeout: 255 seconds]
Ziyan has joined #ruby
bit4bit has quit [Ping timeout: 244 seconds]
samic2004 has quit [Quit: leaving]
bit4bit has joined #ruby
bit4bit has quit [Remote host closed the connection]
bit4bit has joined #ruby
Ziyan has quit [Ping timeout: 272 seconds]
Ziyan has joined #ruby
ur5us has quit [Ping timeout: 272 seconds]
sgt_chuckles has quit [Quit: Client closed]
jpn has joined #ruby
_aeris_ has quit [Ping timeout: 268 seconds]
_aeris_ has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
cocalero has joined #ruby
markong has quit [Ping timeout: 268 seconds]
_aeris_ has quit [Remote host closed the connection]
aeris- has joined #ruby
Ziyan has quit [Ping timeout: 244 seconds]
Ziyan has joined #ruby
Ziyan has quit [Ping timeout: 260 seconds]
Ziyan has joined #ruby
Ziyan has quit [Ping timeout: 240 seconds]
Ziyan has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
bit4bit has quit [Ping timeout: 268 seconds]
Ziyan has quit [Ping timeout: 268 seconds]
Ziyan has joined #ruby
jl- has joined #ruby
jl- has quit [Ping timeout: 268 seconds]
jpn has quit [Ping timeout: 268 seconds]
justtryingirc has joined #ruby
justtryingirc has quit [Client Quit]
TomyWork has quit [Remote host closed the connection]
jpn has joined #ruby
jpn has quit [Ping timeout: 255 seconds]
hellstabber has joined #ruby
hellstabber has left #ruby [#ruby]
jpn has joined #ruby
aeris- is now known as aeris
hellstabber has joined #ruby
hellstabber has left #ruby [#ruby]
jpn has quit [Ping timeout: 272 seconds]
jpn has joined #ruby
Ziyan has quit [Ping timeout: 276 seconds]
Ziyan has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
cocalero has quit [Quit: Going offline, see ya! (www.adiirc.com)]
___nick___ has quit [Ping timeout: 268 seconds]
arfy8820 has joined #ruby
Ziyan has quit [Ping timeout: 272 seconds]
arfy has quit [Ping timeout: 240 seconds]
Ziyan has joined #ruby
arfy8820 is now known as arfy
jpn has joined #ruby
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
cAMP has joined #ruby
<cAMP> Hello #ruby. I'm designing a game with this rule calculator. https://github.com/csmr/mutonex/blob/master/src/ruleset/rule-calculator.rb
nirvdrum has joined #ruby
<cAMP> Assuming one has 3 different sizes of World grid (line 42), what would be a good way to express this, and how to best calculate the resulting spread of values? Something with ranges perhaps?
<cAMP> ATM on line 51 there is just the medium sized world for the calcs.
<musashi> adam12: Cheers mate!
<musashi> Unpoly it is :thumbsup:
<musashi> Also:
<musashi> HAT-P-7b, the exoplanet that contains clouds of vaporized ruby
Wilbur8 has joined #ruby
jl- has joined #ruby
Linux_Kerio has quit [Ping timeout: 272 seconds]
jpn has quit [Ping timeout: 240 seconds]
aeris has quit [Remote host closed the connection]
aeris has joined #ruby
kristianpaul has joined #ruby
<kristianpaul> o/
<kristianpaul> Do you know of other pkcs7 implementation outside openssl's?
<Zerock> I have a class with a hash which I would like to map from strings to other classes. These other classes are subclasses of this class. When I try to initialize this hash, I get a NameError because those other classes are defined further down the file. What am I doing wrong?
<cAMP> declare classes before attempting to use them?
<Zerock> I can't declare a subclass without first declaring the superclass...
Wilbur8 has quit [Ping timeout: 268 seconds]
<cAMP> Seem to me you think other than what you have implemented.
<cAMP> In any case, next step in irc debug would be a link to a pastebin or gist
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
<weaksauce> yeah gist some stuff
<Zerock> this is essentially what I have http://paste.debian.net/1248002/
<Zerock> the declaration of MAP throws NameError
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
<weaksauce> a simple way but probably need to rethink your design in all honesty would be to declare stub classes at the top of your module and then reopen them later
<Zerock> yeah that's ugly
<cAMP> Maybe instead of inheritance, attempt to use mix-in approach.
<Zerock> hmmm
<Zerock> there's an idea
dionysus69 has joined #ruby
twosuns has joined #ruby
musashi has quit [Quit: leaving]
jpn has joined #ruby
<Zerock> What is this... I have a class Foo with a class method self.bar that I want to pass in to another method as a block. I tried &Foo.method(:bar) but I'm getting a TypeError: no implicit conversion of Method into Array
<Zerock> why does it think I'm trying to convert to an array?
<Zerock> if it matters, the method to which I'm trying to pass it looks like: def my_method(arg, &block)
markong has joined #ruby
_aeris_ has joined #ruby
aeris has quit [Ping timeout: 268 seconds]
twosuns has quit [Quit: Leaving]
_aeris_ is now known as aeris
dionysus69 has quit [Ping timeout: 268 seconds]
_ht has quit [Ping timeout: 268 seconds]
_ht has joined #ruby
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
_ht has quit [Ping timeout: 272 seconds]
_ht has joined #ruby