rippa has quit [Read error: Connection reset by peer]
rippa has joined #ruby
LenPayne has joined #ruby
akem has joined #ruby
rippa has quit [Read error: Connection reset by peer]
Petruchio has joined #ruby
rippa has joined #ruby
<Petruchio>
I'm dynamically generating methods, and I can't seem to replicate all the parameter possibilities of a written-out method.
adu has joined #ruby
<Petruchio>
For instance, if I have a hash x representing the parameter structure I want, I could say: define_method(:whatever) { |**x| do stuff }. That's good for optional named parameters.
<Petruchio>
However I can't figure how to pass in something which would create required named parameters.
<adam12>
Petruchio: { |foo:, **x| } won't work?
<Petruchio>
It does, I believe, but I don't want to write that in.
<Petruchio>
I'm trying to pass everything in.
<adam12>
Oh. You wanted optional named params.
<havenwood>
Petruchio: In Ruby 3.0, there's a new `...` feature. Is that what you mean? All types of params?
<Petruchio>
Hm. I've seen that.
lxsameer has joined #ruby
<adam12>
Oooh. You're looking to delegate params? Maybe I was misunderstanding.
<Petruchio>
It's in the output of obj.method(:whatever).parameters
<havenwood>
Petruchio: Can you repeat what you want again, saying it another way?
<Petruchio>
Yes.
TomyLobo has quit [Read error: Connection reset by peer]
<Petruchio>
For instance, if I had some variable n, such that define_method(:name) { |n| do stuff } would give the same output as define_method(:name) { |this:, that: 3| do stuff }
<Petruchio>
That is: I could specify both named parameters with defaults, and ones without.
<Petruchio>
I will be looping and creating methods, and I can't get all the same argument signatures I can by hard-coding them.
ChmEarl has quit [Quit: Leaving]
<havenwood>
Petruchio: So basically you want macros. ;) Hem.
<Petruchio>
Really, it's pretty impressive how close Ruby has gotten as it is.
<Petruchio>
Alternately: could I take a method with the parameter signature that I want, and use it to create a different one with the same signature?
<Petruchio>
For instance: def master(a:, b: 2); ; end; define_method(:student) { |somehow get this from master| do stuff }
<Petruchio>
That's probably not how you'd do it, but you get the sense.
<adam12>
It's doable but you'd have to do the work yourself. Pull the signature from `parameters` then compose it into something that could be passed to `def`.
<Petruchio>
Hm. Yeah, I suppose I could have the method body do the validation, then, and raise ArgumentError if there's a problem.
sphex_ has joined #ruby
<Petruchio>
By the way, is there a way to generate documentation on generated methods?
sphex has quit [Ping timeout: 260 seconds]
<havenwood>
Petruchio: In Ruby 3.0, the type-profiler signatures look a lot like docs to me.
<Petruchio>
I'm thinking about RDoc. Obviously if things were conditionally generated, it wouldn't be possible, but if it was a straight run, maybe. I'm not sure how it does its work.
<Petruchio>
As a Bear of Very Little Brain, I'm impressed. :-)
<havenwood>
Petruchio: Same here.
<Petruchio>
That's ridiculous. And hilarious.
<Petruchio>
I'm defintely glad I asked.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<Petruchio>
Mimic makes sense, and goes at it in a tidy way. Given that, winding up with class_eval seems fine.
<Petruchio>
Okay, thanks.
Tempesta has joined #ruby
gix- has quit [Ping timeout: 260 seconds]
ramfjord has joined #ruby
alfiemax has joined #ruby
alfiemax_ has joined #ruby
alfiemax has quit [Ping timeout: 272 seconds]
ur5us has quit [Ping timeout: 240 seconds]
Mrgoose has quit [Ping timeout: 272 seconds]
GankMove has joined #ruby
alfiemax_ has quit [Remote host closed the connection]
alfiemax has joined #ruby
Mrgoose has joined #ruby
llua has quit [Remote host closed the connection]
llua has joined #ruby
cd has quit [Quit: cd]
alfiemax has quit [Ping timeout: 258 seconds]
vondruch has joined #ruby
alfiemax has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
mnathani has quit []
rafadc has joined #ruby
rafadc has quit [Client Quit]
stan has quit [Quit: killed]
finn[m] has quit [Quit: killed]
hsiktas[m] has quit [Quit: killed]
sepp2k has quit [Quit: killed]
Arkaniad has quit [Quit: killed]
turt2live has quit [Quit: killed]
MeVegan[m] has quit [Quit: killed]
nod0n[m] has quit [Quit: killed]
burgestrand has joined #ruby
roshanavand_ has joined #ruby
roshanavand has quit [Ping timeout: 272 seconds]
roshanavand_ is now known as roshanavand
MeVegan[m] has joined #ruby
a-l-e has joined #ruby
dfucci has joined #ruby
imode has quit [Ping timeout: 256 seconds]
cuerbot has joined #ruby
stoffus has joined #ruby
elcuervo has quit [Ping timeout: 260 seconds]
rafadc has joined #ruby
rafadc has quit [Ping timeout: 244 seconds]
ldepandis has joined #ruby
Rudd0 has quit [Ping timeout: 240 seconds]
adu has quit [Quit: adu]
rafadc has joined #ruby
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #ruby
cloveistaken has joined #ruby
_whitelogger has joined #ruby
hsiktas[m] has joined #ruby
turt2live has joined #ruby
nod0n[m] has joined #ruby
Arkaniad has joined #ruby
sepp2k has joined #ruby
stan has joined #ruby
finn[m] has joined #ruby
r34lp0w3r[m] has joined #ruby
Romain[m] has joined #ruby
BSaboia has joined #ruby
linuus[m] has joined #ruby
podman has joined #ruby
splud has joined #ruby
w10x12 has left #ruby ["WeeChat 2.3"]
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
ellcs1 has joined #ruby
ellcs1 has quit [Ping timeout: 260 seconds]
yasumi2136 has quit [Quit: Konversation terminated!]
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
DTZUZU_ is now known as DTZUZU
ur5us has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
alfiemax has quit [Remote host closed the connection]
BSaboia has quit [Quit: This computer has gone to sleep]
alfiemax has joined #ruby
splud has quit [Ping timeout: 240 seconds]
alfiemax has quit [Remote host closed the connection]
dionysus69 has joined #ruby
splud has joined #ruby
splud has quit [Ping timeout: 246 seconds]
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
splud has joined #ruby
splud has quit [Changing host]
splud has joined #ruby
Lewix has quit [Ping timeout: 260 seconds]
fowl has quit [Ping timeout: 260 seconds]
fowl has joined #ruby
Lewix has joined #ruby
weaksauce has quit [Ping timeout: 264 seconds]
vondruch has quit [Ping timeout: 260 seconds]
ap4y has quit [Ping timeout: 240 seconds]
splud has quit [Ping timeout: 246 seconds]
splud has joined #ruby
bsdbandit-01 has joined #ruby
bsdbandit-01 has quit [Excess Flood]
bsdbandit-01 has joined #ruby
akem_ has joined #ruby
akem has quit [Ping timeout: 260 seconds]
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
splud has quit [Ping timeout: 256 seconds]
burgestrand has quit [Quit: burgestrand]
Rudd0 has joined #ruby
lxsameer has quit [Quit: WeeChat 2.9]
vondruch has joined #ruby
Ai9zO5AP has quit [Ping timeout: 240 seconds]
Ai9zO5AP has joined #ruby
mozzarella has quit [Remote host closed the connection]
mozzarella has joined #ruby
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
TCZ has joined #ruby
alfiemax has joined #ruby
akem has joined #ruby
akem_ has quit [Ping timeout: 260 seconds]
nemesit|znc has joined #ruby
akem_ has joined #ruby
alfiemax has quit [Ping timeout: 265 seconds]
akem has quit [Ping timeout: 240 seconds]
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
Ai9zO5AP has quit [Remote host closed the connection]
burgestrand has joined #ruby
alexherbo2 has joined #ruby
bamdad has quit [Remote host closed the connection]
bamdad has joined #ruby
lxsameer has joined #ruby
drincruz has joined #ruby
drincruz has quit [Ping timeout: 272 seconds]
ellcs1 has joined #ruby
drincruz has joined #ruby
Jonopoly has joined #ruby
ellcs1 has quit [Ping timeout: 260 seconds]
Swyper has joined #ruby
Swyper_ has joined #ruby
Swyper has quit [Read error: Connection reset by peer]
mikecmpbll has quit [Ping timeout: 258 seconds]
teclator has quit [Remote host closed the connection]
mikecmpbll has joined #ruby
wallace_mu has joined #ruby
adu has joined #ruby
joshuacronemeyer has joined #ruby
mcr has joined #ruby
Swyper_ has quit [Remote host closed the connection]
Swyper has joined #ruby
<mcr>
hi. rubygems.org has an IPv6 which does not seem to work. It seems that "gem" does not try all IPs. [That's two bugs]. I think that I can find the right place to report the bug on gems, but who is operationally responsible for rubygems.org?
<adam12>
mcr: For the IP, might be easiest to email support@rubygems.org
<adam12>
/home/adam/.gem/ruby/3.0.0/gems/typeprof-0.1.4/lib/typeprof/analyzer.rb:95:in `merge': undefined method `union' for :top:Symbol (NoMethodError) :(
a-l-e has quit [Ping timeout: 246 seconds]
<adam12>
Actually that was my bad. I was thinking it accepted a glob
<adam12>
but in reality it just accepts an entry point.
Liothen has quit [Ping timeout: 260 seconds]
sarmiena_ has joined #ruby
Liothen has joined #ruby
<sarmiena_>
Is there a native way to parse PDT out of a date string like this? Thu, 08 Oct 2020 10:33:52 PDT -07:00
zacts has quit [Quit: leaving]
zacts has joined #ruby
<havenwood>
sarmiena_: What's your desired return value? Is it?: "PDT"
<havenwood>
sarmiena_: Say just a bit more about what you have and what you want?
<havenwood>
sarmiena_: Are you trying to remove the timezone? Or?
<sarmiena_>
yeah PDT in this case. I see lots of strftime options. It's something I want to use to pass into my DB so that it can give me the date in the zone i want so I don't have to iterate through them in ruby
alexherbo2 has quit [Ping timeout: 240 seconds]
<sarmiena_>
strftime doesn't have anything to take a date object and output the timezone
<sarmiena_>
i can see how to get the offset, but I need PDT or PST, EDT or EST, etc
<havenwood>
sarmiena_: you can just write `PDT` and it'll tell you :)
rippa has quit [Read error: Connection reset by peer]
ramfjord has joined #ruby
alexherbo2 has joined #ruby
joshuacronemeyer has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
adu has quit [Quit: adu]
rippa has joined #ruby
alexherbo2 has quit [Ping timeout: 272 seconds]
CrazyEddy has quit [Ping timeout: 246 seconds]
CrazyEddy has joined #ruby
alfiemax has joined #ruby
davispuh has joined #ruby
Swyper has quit [Remote host closed the connection]
bsdband11 has joined #ruby
bsdband11 has quit [Read error: Connection reset by peer]
bsdband21 has joined #ruby
bsdbandit-01 has quit [Ping timeout: 240 seconds]
vondruch has quit [Ping timeout: 240 seconds]
sarmiena_ has quit [Remote host closed the connection]
alexherbo2 has joined #ruby
AndreYuhai has joined #ruby
<AndreYuhai>
How can I use "expect" using Capybara?
<AndreYuhai>
I mean when I do expect(browser).to I get undefined method error
<AndreYuhai>
I couldn't really get how that works. I could simply use selenium-webdriver and I am probably making things more difficult but I just wanted to learn :D
<AndreYuhai>
I included capybara/rspec as wel
zacts has quit [Quit: leaving]
zacts has joined #ruby
greengriminal has quit [Quit: Leaving]
<adam12>
AndreYuhai: What are you testing exactly? I believe Capybara just hides these things for you. So you'd be looking for someting like expect(page).to have_content("ohai")
<AndreYuhai>
adam12, I am not really testing though. Just scraping stuff. I would like to do a "wait_until" to check whether an element appears on the page after logging in.
<AndreYuhai>
so that I know I successfully logged in.
<adam12>
AndreYuhai: Ohh. You might want something outside of Capybara then...
<AndreYuhai>
adam12, that's what I'd thought actually. I mean you can probably do it with Capybara too but it seemed to complicated.
<AndreYuhai>
too*
<adam12>
I like the ones powered by Cuprite. I find Selenium in the middle of adapter + Chrome somewhat complex.