<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]
<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]
<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?
<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]