adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.2, 2.7.4, 2.6.8: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
<leftylink> I see. you'll have to do a flat_map followed by a to_h on the result of the flat_map, then.
desnudopenguino has joined #ruby
<rob> Ah ha, I just came up with another solution which seems a bit kludgey: Array.new.tap {|a| hash.invert.each_pair {|k, v| k.each {|w| a << {w => v}}} }.reduce({}, :merge)
<rob> Let's have a look at flat_map...
<rob> Thanks!
ur5us has quit [Ping timeout: 250 seconds]
goldfish has quit [Quit: Leaving]
ur5us has joined #ruby
desnudopenguino has quit [Remote host closed the connection]
Artea has joined #ruby
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
rob has quit [Ping timeout: 250 seconds]
roadie has joined #ruby
SuperLag has joined #ruby
Rounin has quit [Ping timeout: 250 seconds]
SuperLag has quit [Ping timeout: 240 seconds]
roadie has quit [Ping timeout: 240 seconds]
venue has quit [Ping timeout: 250 seconds]
MalkbabY has joined #ruby
thad_the_man has joined #ruby
aeris has quit [Remote host closed the connection]
aeris has joined #ruby
<thad_the_man> Is there a reverse String.scan? meaning find the last match firsty then the second to last match etc.
venue has joined #ruby
roadie has joined #ruby
Skyfire has quit [Ping timeout: 250 seconds]
michigan has quit [Quit: Connection closed for inactivity]
neshpion has quit [Quit: neshpion]
thad_the_man has quit [Ping timeout: 240 seconds]
ur5us has quit [Quit: Leaving]
ur5us has joined #ruby
thad_the_man has joined #ruby
MalkbabY has quit [Remote host closed the connection]
MalkbabY has joined #ruby
thad_the_man has quit [Ping timeout: 250 seconds]
jpw has joined #ruby
jpw has quit [Ping timeout: 250 seconds]
jpw has joined #ruby
mjh has joined #ruby
hololeap has quit [Remote host closed the connection]
hololeap has joined #ruby
venue has quit [Quit: adios]
ur5us has quit [Ping timeout: 250 seconds]
roadie has quit [Ping timeout: 250 seconds]
roadie has joined #ruby
jpw has quit [Remote host closed the connection]
<nakilon> newton oh, vcr, I now reread your question for more understanding what you meant
<nakilon> first of all you did a decision of where you mock
<nakilon> when I was making high level tests over my external API library I didn't use VCR, I did my own 15 lines long replacement that was mocking the library, not the API
<nakilon> you could pass any module to my mocker -- it was recording the ruby calls
<nakilon> oh, and probably those were rather tests of something that uses my library, not the tests of the library
roadie has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
pwnd_sfw has quit [Ping timeout: 252 seconds]
TomyWork has joined #ruby
roadie has quit [Ping timeout: 250 seconds]
jdcain has joined #ruby
noa has joined #ruby
kinduff4 has joined #ruby
kiki_lamb has quit [Ping timeout: 250 seconds]
roadie has joined #ruby
kinduff has quit [Ping timeout: 248 seconds]
kinduff4 is now known as kinduff
MalkbabY has quit [Remote host closed the connection]
MalkbabY has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
kiki_lamb has joined #ruby
elf_fortres has joined #ruby
kiki_lamb has quit [Ping timeout: 250 seconds]
Oxfuxxx has quit [Quit: leaving]
elf_fortres has quit [Ping timeout: 246 seconds]
Oxfuxxx has joined #ruby
roadie has joined #ruby
kiki_lamb has joined #ruby
kiki_lamb has quit [Ping timeout: 248 seconds]
rubion has joined #ruby
kiki_lamb has joined #ruby
kiki_lamb has quit [Ping timeout: 240 seconds]
rubion has quit [Ping timeout: 250 seconds]
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
kiki_lamb has joined #ruby
kiki_lamb has quit [Ping timeout: 252 seconds]
nik has joined #ruby
mrkz_c has quit [Quit: Connection closed for inactivity]
Oxfuxxx has quit [Ping timeout: 240 seconds]
Oxfuxxx has joined #ruby
kiki_lamb has joined #ruby
VoidNoir0 has joined #ruby
kiki_lamb has quit [Ping timeout: 252 seconds]
Oxfuxxx has quit [Ping timeout: 252 seconds]
ur5us has joined #ruby
noa has quit [Quit: Leaving]
roadie has joined #ruby
joenoon has quit []
joenoon has joined #ruby
kiki_lamb has joined #ruby
Oxfuxxx has joined #ruby
kiki_lamb has quit [Ping timeout: 240 seconds]
Guest48 has joined #ruby
<Guest48> Hello, I have an existing table `orders` and a corresponding `Order`. The table has a column `status` which is an enum consisting of the values (pending, unprocessed, processed). The model has the enum as `enum status: { pending: "pending", unprocessed: "unprocessed", processed: "processed" }`
<Guest48> I want to add a value called `delivered` after `pending` in the enum. So my migration looks like `ALTER TYPE status ADD VALUE delivered AFTER pending`. I added the same in the model - `{ pending: "pending", delivered: "delivered", ...}`
<Guest48> I want to know if this will cause any problems as enum values are stored as integers AFAIK
kiki_lamb has joined #ruby
<Guest48> Just want to make sure any existing data does not get affected by this!
kiki_lamb has quit [Ping timeout: 240 seconds]
Oxfuxxx has quit [Ping timeout: 248 seconds]
ur5us has quit [Ping timeout: 250 seconds]
Oxfuxxx has joined #ruby
Guest48 has quit [Quit: Client closed]
kiki_lamb has joined #ruby
<nakilon> just wanted to ask #yard guys about why are so many gem docs down on their ruby-doc website for a while now, but looks like the channel didn't migrate from freenode or wasn't alive there in the first place
<nakilon> is there any mirror?
kiki_lamb has quit [Ping timeout: 240 seconds]
Oxfuxxx has quit [Quit: leaving]
roadie has quit [Ping timeout: 240 seconds]
kiki_lamb has joined #ruby
roadie has joined #ruby
Oxfuxxx has joined #ruby
kiki_lamb has quit [Ping timeout: 248 seconds]
kiki_lamb has joined #ruby
Skyfire has joined #ruby
kiki_lamb has quit [Ping timeout: 250 seconds]
MalkbabY has quit [Remote host closed the connection]
MalkbabY has joined #ruby
kiki_lamb has joined #ruby
kiki_lamb has quit [Ping timeout: 248 seconds]
Oxfuxxx has quit [Ping timeout: 248 seconds]
Oxfuxxx has joined #ruby
kiki_lamb has joined #ruby
kiki_lamb has quit [Ping timeout: 248 seconds]
noa has joined #ruby
noa has quit [Client Quit]
kiki_lamb has joined #ruby
Oxfuxxx has quit [Remote host closed the connection]
rob has joined #ruby
Oxfuxxx has joined #ruby
Oxfuxxx has quit [Client Quit]
kiki_lamb has quit [Ping timeout: 240 seconds]
Oxfuxxx has joined #ruby
rob has quit [Ping timeout: 240 seconds]
kiki_lamb has joined #ruby
kiki_lamb has quit [Ping timeout: 240 seconds]
roadie has quit [Ping timeout: 250 seconds]
kiki_lamb has joined #ruby
xuochi has joined #ruby
kiki_lamb has quit [Ping timeout: 248 seconds]
elf_fortrez has joined #ruby
roadie has joined #ruby
kiki_lamb has joined #ruby
kiki_lamb has quit [Ping timeout: 240 seconds]
thad_the_man has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
kiki_lamb has joined #ruby
Xeago has quit [Ping timeout: 252 seconds]
noa has joined #ruby
Xeago has joined #ruby
kiki_lamb has quit [Ping timeout: 248 seconds]
<EdwardIII> hey, does anyone know a way to automatically wrap all minitest tests (the default format, not minitest spec) with VCR?
<EdwardIII> i found this but it looks like it only works with minitest spec: https://github.com/mfpiccolo/minitest-vcr
noa has quit [Quit: Leaving]
noa has joined #ruby
<adam12> EdwardIII: If you're not dependency adverse, minitest-hooks from Jeremy Evans. Then use one of the _all hooks.
<EdwardIII> i'm dependency positive :) thanks adam12
<adam12> EdwardIII: If you are dependency adverse, I think you can overwrite the `run` method to call `VCR.use_cassete do super end`
<adam12> Since I have a love/hate relationship with VCR, my only suggestion is ensure that you can easily record a test or all tests. Because what happens on projects is the VCR cassette is recorded and nobody in the future can re-record it, because it relies on a bunch of implied state or specific test order.
<EdwardIII> yeah i've used VCR-similar things in the past and you can absolutely shoot yourself in the foot
<EdwardIII> sometimes it's kind of impossible to get around taht though. for example, if i have some code that hits a third party endpoint with some dates in the request, eventually that's always going to stop working. so once that date passes, someone will definitely not be able to blow those VCR files away
<EdwardIII> the only other choice is to i guess pull those ones out of VCR and put 'em in as proper fixtures instead or something, to at least have that line in the sand
<EdwardIII> hey cool if you have rails it looks like you can do this (and probably works without rails by re-opening the minitest test class): https://gist.github.com/EdwardIII/0a27e6e82f06ae350ed3d9085f5ed889
kiki_lamb has joined #ruby
<adam12> I wonder if those are the private hooks? Minitest has a few that are made for plugin authors.
<adam12> I frequently wrap my 3rd party interactions and then just have a single test that does a bunch of them in line. Wrap that in a cassette.
<adam12> Everything else is owned by me, so I mock/stub to my hearts content.
<EdwardIII> sounds like a good idea. this is for a legacy project so things are a bit distributed
<EdwardIII> i'm actually trying to use vcr with savon so we'll see how that goes
<leah2> is there any percent escaping code in stdlib suitable for data: uri? i.e. turn space into %20 not +
<EdwardIII> i bet SOAP requires it to do something stupid like add a timestamp to every request body or something. we'll see
kiki_lamb has quit [Ping timeout: 250 seconds]
<leah2> ERB::Util.url_encode seems to do the job
elf_fortrez has quit [Ping timeout: 246 seconds]
<adam12> leah2: I have this hack in a project somewhere, unforutnately. CGI.escape(str).gsub("+", "%20")
noa has quit [Quit: Leaving]
noa has joined #ruby
<leah2> ERB::Util.url_encode encodes a bit more but it does no harm here
<leah2> stuff like ()
<EdwardIII> leah2: does URL::Escape not do what you need?
<leah2> what's that?
<EdwardIII> i think it also lets you control the characters a bit if you want to
<leah2> Nothing known about URI::Escape
<leah2> i use ruby 3 btw
<leah2> doesnt seem to exist here
<EdwardIII> ah sorry looks like that got deprecated. i'm a bit behind
<leah2> i used URI.escape before
<leah2> query strings use +
<leah2> but data: uri not afaiu
<EdwardIII> ah ha
kiki_lamb has joined #ruby
<EdwardIII> heh magic, starts off working pretty nicely, then about 100 test cases in something is throwing an exception as it's not getting something it expects
<EdwardIII> it was almost *too* easy
kiki_lamb has quit [Ping timeout: 248 seconds]
Oxfuxxx_ has joined #ruby
Oxfuxxx has quit [Ping timeout: 250 seconds]
kiki_lamb has joined #ruby
rob has joined #ruby
kiki_lamb has quit [Ping timeout: 240 seconds]
<adam12> O_O
Oxfuxxx_ has quit [Read error: Connection reset by peer]
<EdwardIII> ah, changed where i'm calling 'super' in the hooks and now everything seems to be passing, nice nice nice!
Oxfuxxx has joined #ruby
<EdwardIII> yep, disconnected from wifi and all tests still pass, beautiful. thanks adam12
kiki_lamb has joined #ruby
bit4bit has joined #ruby
<EdwardIII> sorry just a bit of a noob question, if i put something in the test deps (like VCR), do `RAILS_ENV=test bundle install`, then `RAILS_ENV=test bundle exec bin/rake test`, it still says 'LoadError: cannot load such file -- vcr'. what's the right approach here?
nik has quit [Quit: Leaving]
kiki_lamb has quit [Ping timeout: 248 seconds]
olspookishmagus has joined #ruby
kiki_lamb has joined #ruby
menace has joined #ruby
menace has joined #ruby
menace has quit [Changing host]
roadie has quit [Ping timeout: 250 seconds]
menace is now known as Deknos
kiki_lamb has quit [Ping timeout: 250 seconds]
elf_fortrez has joined #ruby
kiki_lamb has joined #ruby
MalkbabY has quit [Remote host closed the connection]
rubion has joined #ruby
MalkbabY has joined #ruby
kiki_lamb has quit [Ping timeout: 250 seconds]
<nakilon> heh, I'm stopped by two bugs at once; https://bugs.ruby-lang.org/issues/13540 -- this thing started happening only after I installed the gem, so the shim requires the ./bin executable with "Kernel#load" and it fails
<nakilon> and another one I haven't yet investigated looks like if your gem binary is a Sinatra app it just does not start
_ht has joined #ruby
roadie has joined #ruby
Guest87 has joined #ruby
Guest87 has left #ruby [#ruby]
<nakilon> (randomly copypasted "enable :run" resolved the second one)
kenliten has joined #ruby
kenliten has left #ruby [#ruby]
rubion has quit [Ping timeout: 252 seconds]
mrkz_c has joined #ruby
jdcain has quit [Quit: WeeChat 3.2]
rubion has joined #ruby
kiki_lamb has joined #ruby
rob has quit [Ping timeout: 252 seconds]
jpw has joined #ruby
elf_fortrez has quit [Quit: Client closed]
bit4bit has quit [Ping timeout: 240 seconds]
TomyWork has quit [Quit: Leaving]
Guest63 has joined #ruby
Guest63 has quit [Client Quit]
Guest45 has joined #ruby
Guest45 has quit [Quit: Client closed]
jpw_ has joined #ruby
Guest45 has joined #ruby
jpw has quit [Ping timeout: 240 seconds]
Guest45 has quit [Client Quit]
work has joined #ruby
<work> Hello, In `ApplicationMailer`, the default hash (`default from: 'from@example.com'`) , is default a method that take a hash as parametre or?
jpw_ is now known as jpw
neshpion has joined #ruby
neshpion is now known as sir_neshpion
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
roadie has quit [Remote host closed the connection]
rubion has quit [Ping timeout: 240 seconds]
sir_neshpion is now known as neshpion
<adam12> EdwardIII: That should work fine. Did you get it solved?
<adam12> work: It looks like it.
roadie has joined #ruby
jpw_ has joined #ruby
rubion has joined #ruby
jpw has quit [Ping timeout: 240 seconds]
bandithijo has joined #ruby
<work> adam12: Yes, Thank you.
Deknos has quit [Ping timeout: 248 seconds]
dviola has quit [Read error: Connection reset by peer]
jpw_ has quit [Ping timeout: 250 seconds]
jpw has joined #ruby
jpw has quit [Ping timeout: 248 seconds]
jpw has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
jpw_ has joined #ruby
roadie has joined #ruby
jpw has quit [Ping timeout: 252 seconds]
jpw_ has quit [Ping timeout: 250 seconds]
jpw has joined #ruby
roadie has quit [Ping timeout: 250 seconds]
elf_fortrez has joined #ruby
jpw has quit [Ping timeout: 250 seconds]
jpw has joined #ruby
Bounga has joined #ruby
ur5us has joined #ruby
_ht has quit [Remote host closed the connection]
Bounga has quit [Remote host closed the connection]
Bounga has joined #ruby
roadie has joined #ruby
elf_fortrez has quit [Quit: Client closed]
MalkbabY has quit [Remote host closed the connection]
MalkbabY has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
jpw_ has joined #ruby
jpw has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
thad_the_man has quit [Ping timeout: 250 seconds]
jpw_ has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 250 seconds]
bandithijo has quit [Ping timeout: 252 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 250 seconds]
work has quit [Quit: Connection closed for inactivity]
rubion has quit [Ping timeout: 250 seconds]
pwnd_sfw has joined #ruby
asarch has joined #ruby
Bounga has quit [Remote host closed the connection]
FetidToot has quit [Read error: Connection reset by peer]
FetidToot has joined #ruby
Bounga has joined #ruby
FetidToot has quit [Ping timeout: 252 seconds]
asarch has quit [Quit: Leaving]
FetidToot has joined #ruby
thad_the_man has joined #ruby
thad_the_man has quit [Remote host closed the connection]
moldorcoder7 has joined #ruby
thad_the_man has joined #ruby
rob has joined #ruby
roadie has joined #ruby
FetidToot has quit [Ping timeout: 240 seconds]
bandithijo has joined #ruby
roadie has quit [Ping timeout: 240 seconds]