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
<leftylink> pandabot: rb def f(a, b: nil, c: {}); "f #{a} #{b} #{c}" end; lambda { |*args, **kwargs| f(*args, **kwargs) }.then { |f| [f[1], f[1, b: 2]] }
<pandabot> ["f 1 {}", "f 1 2 {}"] - https://carc.in/#/r/dr7x
<leftylink> just making sure
<plujon> So, this would work under Ruby 3: Stripe::StripeClient.send(:define_method, :execute_request) { |*args, **kwargs| instance.mock_request(*args, **kwargs) }
<plujon> Stripe::StripeClient.define_method(:execute_request) { |*args, **kwargs| instance.mock_request(*args, **kwargs) } # or maybe this is better...
markong has quit [Ping timeout: 265 seconds]
skuntee4 has joined #ruby
aeris has quit [Remote host closed the connection]
aeris has joined #ruby
skuntee4 has quit [Ping timeout: 265 seconds]
skuntee4 has joined #ruby
fercell has joined #ruby
fercell has quit [Ping timeout: 265 seconds]
skuntee4 has quit [Ping timeout: 268 seconds]
petgoat has joined #ruby
John_Ivan__ has quit [Ping timeout: 265 seconds]
Sheilong has joined #ruby
mikecmpbll has quit [Ping timeout: 264 seconds]
mikecmpbll has joined #ruby
mikecmpbll has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 250 seconds]
libsys has quit [Remote host closed the connection]
libsys has joined #ruby
weaksauc_ has joined #ruby
weaksauce has quit [Ping timeout: 260 seconds]
Linux_Kerio has joined #ruby
fercell has joined #ruby
fercell has quit [Ping timeout: 250 seconds]
fercell has joined #ruby
fercell has quit [Ping timeout: 264 seconds]
taiju has quit [Ping timeout: 268 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
m-antis has quit [Ping timeout: 250 seconds]
Sheilong has quit []
taiju has joined #ruby
plujon has quit [Ping timeout: 268 seconds]
fercell has joined #ruby
fercell has quit [Ping timeout: 268 seconds]
fercell has joined #ruby
mdemo has quit [Quit: The Lounge - https://thelounge.github.io]
fercell has quit [Ping timeout: 265 seconds]
protektwar has joined #ruby
protektwar has joined #ruby
mikecmpbll has joined #ruby
AstrallyForged has joined #ruby
<AstrallyForged> .hg Is there anything in the standard library that can do command-line argument parsing with positional arguments? I need to be able to parse e.g. `ruby thing.rb --foo=bar quux`.
<AstrallyForged> .hg I'm trying to search the web for this, but for some reason it looks like all of the results only do flags and not positional arguments?
<AstrallyForged> .hg Restricting this to the standard library because I'm modifying someone else's project and I don't want to add to their dependencies.
mikecmpbll has quit [Ping timeout: 268 seconds]
donofrio_ has joined #ruby
donofrio__ has joined #ruby
donofrio has quit [Ping timeout: 264 seconds]
donofrio_ has quit [Ping timeout: 264 seconds]
ur5us has quit [Ping timeout: 244 seconds]
ur5us has joined #ruby
protektwar has quit [Ping timeout: 268 seconds]
ur5us has quit [Ping timeout: 244 seconds]
ur5us has joined #ruby
turkeys1 has joined #ruby
turkeys1 has quit [Ping timeout: 264 seconds]
jpn has joined #ruby
dionysus69 has joined #ruby
jpn has quit [Ping timeout: 244 seconds]
darkstardev13 has quit [Remote host closed the connection]
reset has quit [Quit: reset]
darkstardev13 has joined #ruby
darkstardev13 has quit [Max SendQ exceeded]
Rounin has joined #ruby
ur5us has quit [Ping timeout: 264 seconds]
taiju has quit [Ping timeout: 244 seconds]
ur5us has joined #ruby
mahlon has quit [Ping timeout: 265 seconds]
mahlon has joined #ruby
jpn has joined #ruby
mahlon has quit [Ping timeout: 264 seconds]
mahlon has joined #ruby
darkstardevx has joined #ruby
darkstardevx has quit [Remote host closed the connection]
darkstardevx has joined #ruby
ur5us has quit [Ping timeout: 244 seconds]
jhass[m] has quit [Quit: Bridge terminating on SIGTERM]
sixecho has quit [Quit: Bridge terminating on SIGTERM]
taiju[m] has quit [Quit: Bridge terminating on SIGTERM]
jollyrogue[m] has quit [Quit: Bridge terminating on SIGTERM]
finsternis has quit [Ping timeout: 244 seconds]
mikecmpbll has joined #ruby
finsternis has joined #ruby
jhass[m] has joined #ruby
mikecmpbll has quit [Ping timeout: 244 seconds]
skuntee4 has joined #ruby
jpn has quit [Ping timeout: 264 seconds]
skuntee4 has quit [Ping timeout: 264 seconds]
<gr33n7007h> AstrallyForged: you can use optparse from the stdlib for this.
sixecho has joined #ruby
taiju[m] has joined #ruby
jollyrogue[m] has joined #ruby
jpn has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
John_Ivan__ has joined #ruby
ur5us has joined #ruby
markong has joined #ruby
<sam113101> guys, what would be the easiest way of getting diagonals from a matrix/array of arrays?
<sam113101> say I have [[0, 1, 2], [3, 4, 5], [6, 7, 8]], I want [[0], [3, 1], [6, 4, 2], [7, 5], [8]]
ur5us has quit [Ping timeout: 264 seconds]
<depesz> where can I find information about command/method "gem"? For example, i can see that one use is 'gem "pp"' another is 'gem 'aws-sdk', '>= 2'
<depesz> wnd: this is doc for writing gemfile - is the gem "command/method" in ruby scripts the same as the one inside gemfile ?
<depesz> i'm mostly interested not in syntax, but what it actually does within ruby program
<wnd> admittedly I can't recall seeing "gem" being used outside a gemfile
<wnd> fwiw, on my devince, method(:gem).source_location -> /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_gem.rb:41
<depesz> specifically, what is the difference between: "require 'xx';" and "gem 'xx'; require 'xx'", and "gem 'xx', '~> 2'; require 'xx'"
<depesz> another question. it looks that by default ruby does `require 'rubygems'` - is there any place this is documented? looks like rubygems is one of "std-libs", but for others, i need `require ...`, not so much for rubygems
mikecmpbll has joined #ruby
darkstardevx has quit [Read error: Connection reset by peer]
dionysus69 has quit [Ping timeout: 244 seconds]
cognemo has quit [Quit: ZNC 1.8.2 - https://znc.in]
cognemo has joined #ruby
<gr33n7007h> depesz: you can pass the command-line flag `--disable-gems` if that's what you're asking
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
<depesz> no. i'm just asking if it's documented anywhere that rubygems are loaded, by default.
<depesz> i see that they are. i see that I can disable it, but is it documneted anywhere that they are?
<gr33n7007h> depesz: why?
protektwar has quit [Remote host closed the connection]
<depesz> because I'm curious. and when something wqorks in some way, I'd like to know more about it than just "it is that way". so i'd assume there is some documentation.
<depesz> for example - are there any other libraries in std-lib that get laoded by default?
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
<gr33n7007h> depesz: look at $LOADED_FEATURES for what is loaded by default
<gr33n7007h> depesz: if it's documented, i've no clue
<depesz> ok, and where can I find documentation for "$LOADED_FEATURES" ?
<depesz> i mean - it's all great, and I understand that it is there. but is there documentation for this?
<leftylink> pandabot: tell depesz rubyglobals
<depesz> https://www.ruby-lang.org/en/documentation/ -> search for "loaded_features" mostly links some bugs
<leftylink> dang i need to change that to 3.0.0 huh
<leftylink> pandabot: learn rubyglobals https://docs.ruby-lang.org/en/3.1/globals_rdoc.html
<pandabot> Re-learned existing fact rubyglobals; 406 facts total
<leftylink> oh that's not good. 3.1 mangles the left/right of successful match chars
<leftylink> I think I can't use that one
<leftylink> pandabot: learn rubyglobals https://docs.ruby-lang.org/en/3.0/globals_rdoc.html
<pandabot> Re-learned existing fact rubyglobals; 406 facts total
<leftylink> back to 3.0 then
<depesz> leftylink: thx.
<gr33n7007h> hey, is the new robot called pandabot now?
<gr33n7007h> pandabot: 1 + 1
<gr33n7007h> how do you invoke evaluation on it?
<gr33n7007h> pandabot: >> 1 + 1
<gr33n7007h> pandabot: &> 1 + 1
<gr33n7007h> i've forgotten
<depesz> pandabot: rb 1 + 1
<depesz> pandabot: rb def f(a, b: nil, c: {}); "f #{a} #{b} #{c}" end; lambda { |*args, **kwargs| f(*args, **kwargs) }.then { |f| [f[1], f[1, b: 2]] }
<depesz> this is/was exact example thatg happened before :)
<depesz> i think it only takes commands from leftylink
<gr33n7007h> leftylink: is the bot for the channel or personal use?
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
<gr33n7007h> depesz: seems so.
<leftylink> we have to keep in mind that allowing to run arbitrary code could be dangerous - what if someone runs system("rm -rf /") or something. I don't think it would be possible to allow anyone to run it
<leftylink> even if it were allowable, auth is hard
dionysus69 has joined #ruby
<depesz> is it not possible to run ruby code in restricted interpreter?
<depesz> asking out of plain curiosity, as perl, for example, has Safe module https://perldoc.perl.org/Safe for this.
ssh0732 has joined #ruby
fercell has joined #ruby
ssh0732 has quit [Client Quit]
markong has quit [Ping timeout: 265 seconds]
fercell has quit [Ping timeout: 268 seconds]
protektwar has quit [Remote host closed the connection]
ssh0732 has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
m-antis has joined #ruby
plujon has joined #ruby
<sam113101> what is method `+@'?
<adam12> depesz: It was an option at one time but I believe it's gone now.
<adam12> gr33n7007h: The ruby bot for the channel seems to die frequently.
<adam12> jhass: Can we give the bot a kick when you get a moment?
<adam12> depesz: You use `gem` when you want to force a specific version, where it may not be the latest one. More common in projects _not_ using Bundler.
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
taiju has joined #ruby
fercell has joined #ruby
cognemo has quit [Quit: ZNC 1.8.2 - https://znc.in]
protektwar has quit [Quit: quitting away..]
cognemo has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
protektwar has quit [Client Quit]
fercell has quit [Ping timeout: 265 seconds]
szkl has joined #ruby
eddof13 has joined #ruby
taiju has quit [Ping timeout: 244 seconds]
protektwar has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has quit [Quit: quitting away..]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Al2O3 has quit [Ping timeout: 268 seconds]
Sankalp- has joined #ruby
Sankalp has quit [Ping timeout: 265 seconds]
Sankalp- is now known as Sankalp
protektwar has quit [Quit: quitting away..]
eddof13 has joined #ruby
Al2O3 has joined #ruby
SteveR has joined #ruby
<havenwood> sam113101: It's called a "unary method" and it defines a `+` *preceding* the receiver.
Rounin has quit [Ping timeout: 244 seconds]
SteveR has quit [Ping timeout: 252 seconds]
jpn has quit [Ping timeout: 264 seconds]
SteveR has joined #ruby
jpn has joined #ruby
jetchisel has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
Artea has joined #ruby
_ht has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
szkl has quit [Quit: Connection closed for inactivity]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
<axisys> how do I compare against multiple strings? need to simplify this https://dpaste.org/eo45Y
<axisys> if options != %w(FOO BAR) will work? probably not?
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
<adam12> axisys: !%w(FOO BAR).include?(options)
<adam12> but maybe there's a better way.. can you show some real code or include more context?
RetroPunk has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
RetroPunk has joined #ruby
jpn has quit [Ping timeout: 264 seconds]
<havenwood> axisys: Should it go up once or twice if it's neither "FOO" nor "BAR"?
reset has joined #ruby
protektwar has quit [Remote host closed the connection]
SteveR has quit [Ping timeout: 252 seconds]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
protektwar has quit [Remote host closed the connection]
fercell has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
fercell has quit [Ping timeout: 244 seconds]
jimeh has quit [Remote host closed the connection]
jimeh has joined #ruby
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fercell has joined #ruby
fercell has quit [Ping timeout: 264 seconds]
m-antis has quit [Ping timeout: 265 seconds]
cocalero has joined #ruby
<axisys> sorry I was away.. so it would be once
<axisys> adam12: so goal is to skip whatever inside the if .. end block for region 'FOO' and region 'BAR'
<axisys> havenwood: sorry I was away.. so it would be once
fercell has joined #ruby
<weaksauc_> steps += options unless options =~ /^(FOO|BAR)$/
fercell has quit [Ping timeout: 250 seconds]
dionysus69 has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
protektwar has quit [Remote host closed the connection]
eddof13 has joined #ruby
_ht has quit [Remote host closed the connection]
eron has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.6]
<havenwood> weaksauc_: +1, that seems nice. I'd just use #match? these days to avoid setting globals.
<weaksauc_> havenwood ah good point
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jpn has joined #ruby
eddof13 has joined #ruby
ruby[bot] has joined #ruby
ur5us has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
perrierjouet has joined #ruby
perrierjouet has quit [Client Quit]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
eron has quit [Ping timeout: 252 seconds]
perrierjouet has joined #ruby
Pixi has quit [Quit: Leaving]
Linux_Kerio has quit [Ping timeout: 252 seconds]
jpn has joined #ruby
jpn has quit [Client Quit]
fercell has joined #ruby
fercell has quit [Ping timeout: 265 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nirvdrum has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nirvdrum has quit [Quit: nirvdrum]
dionysus69 has quit [Ping timeout: 265 seconds]
Pixi has joined #ruby
finsternis has quit [Read error: Connection reset by peer]
gschanuel5 has joined #ruby
gschanuel has quit [Ping timeout: 244 seconds]
gschanuel5 is now known as gschanuel
perrierjouet has quit [Quit: WeeChat 3.6]
m-antis has joined #ruby
fercell has joined #ruby
weaksauc_ has quit [Ping timeout: 250 seconds]
weaksauce has joined #ruby
fercell has quit [Ping timeout: 265 seconds]
eddof13 has joined #ruby
fercell has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fercell has quit [Ping timeout: 265 seconds]
taiju has joined #ruby