<havenwood>
Swyper: @result_of_reject is an Array. You can't just []().
<havenwood>
&>> []()
<rubydoc>
stderr: -e:4: syntax error, unexpected '(', expecting end... check link for more (https://carc.in/#/r/80a5)
<havenwood>
Swyper: That's ^ the error you're running into.
greengriminal has joined #ruby
alfiemax has joined #ruby
<Swyper>
havenwood I updated the repo
<havenwood>
Swyper: working now?
<Swyper>
nope
<Swyper>
@result_of_reject = @current_dishes.reject { |dish| dish.to_s == dish_to_add_ingredients} p "enter the ingredients seperated by a comma for this dish: " + @result_of_reject[0].to_s
<Swyper>
so it dosent actually grab the correct dish for some reason
Intelo_ has quit [Ping timeout: 268 seconds]
<Swyper>
chef.rb:42:in `add_ingredients': undefined method `ingredients' for nil:NilClass (NoMethodError)
<Swyper>
also is my use of naming the method to_s inapropriate here?
<Swyper>
(byebug) @result_of_reject[]
<Swyper>
so tldr its not grabbing the correct object
<Swyper>
or any object.
<havenwood>
Swyper: The default for @current_dishes is an empty Array. The first element of @result_of_reject will then be `nil`.
<havenwood>
Swyper: It's expected that `nil.ingredients` will raise this error.
<Swyper>
havenwood so I do add the fish dish to it, so at that point current_dish = ["fish"]
<Swyper>
**current_dishes
<Swyper>
sorry I'll post the whole thing
<Swyper>
sec
<havenwood>
Swyper: I don't know what your logic should result in. Up to you.
<havenwood>
Swyper: Up to you what the default is and what you do.
Intelo_ has joined #ruby
<Swyper>
the default should have no values, since we did not add any dishes at that point
<havenwood>
Swyper: So what should the code do when there's no first argument? Do that.
<Swyper>
okay, I also updated the gist
<Swyper>
it now shows that fish is indeed added as an element of the array
akem__ has quit [Ping timeout: 240 seconds]
<Swyper>
if @result_of_reject == [] return end ?
akem__ has joined #ruby
<Swyper>
the case where there is no first arguments is handled xD
<Swyper>
it just ends the function call and goes back to the loop
<Swyper>
github updated
<leftylink>
did different people work on this code? why is result_of_reject such a meaningless name compared to meaningful n ames like dish_to_add_ingredients and ingredients_to_add ?
<Swyper>
all me xD
<Swyper>
I usually write sloppy code then once its working I refactor it lol
akemhp_ has quit [Ping timeout: 252 seconds]
roadt has quit [Ping timeout: 240 seconds]
<Swyper>
this branch is named add-funct, its supposed to be additional functionality for something I'm working on
<Swyper>
enter the name of the dish you wish to ingredients to: fish"enter the ingredients seperated by a comma for this dish: apple"
<Swyper>
tff
brool has quit [Ping timeout: 250 seconds]
<Swyper>
ah logic was broken
Tempesta has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
davidw has joined #ruby
<Swyper>
dish.ingredients.each do |ingredient| puts "\t " + ingredient + "\n" end
<Swyper>
chef.rb:74:in `+': no implicit conversion of Array into String (TypeError)
<Swyper>
hmm
<Swyper>
so the ingredients is an array and I'm looping through it
sandstrom has quit [Quit: My computer has gone to sleep.]
<baweaver>
Eh, it's not that bad.
<twb>
it's just completely unnecessary, because they never read from the file
<baweaver>
Then fix it
<twb>
Sorry, that was a question :-)
<twb>
I don't normally babysit ruby so I was a bit paranoid that there might be some weird edge-case
<baweaver>
Remember not everyone writing Ruby knows it well
<baweaver>
More often than not they're just looking for a solution and maybe some SO post had that
<baweaver>
Could probably just outright use `File.write` instead.
mozzarella has joined #ruby
<twb>
Heh, cool.
rainmanj_ has joined #ruby
<baweaver>
Be careful in calling code crappy or bad
<twb>
One of the few things I like in perl is that you can "use criticism;" and if your coworker does something dumb, it'll yell at them automatically
<baweaver>
Instead say something to the extent of "Have you considered this alternative?" when reviewing, or "I think this code can be simplified like ..."
dbugger has joined #ruby
<baweaver>
when opening a PR
<twb>
baweaver: yeah fair. This particular person has already been sacked acrimoniously and I've been called in to clean up the mess
rainmanjam has quit [Ping timeout: 252 seconds]
<twb>
So *this* time I don't mind if I hurt their feelings
<baweaver>
but the more negative a reaction you display openly the less likely people will be to open up or seek advise
<baweaver>
Always be kind when possible, even to those who can't hear you
<twb>
fair
<baweaver>
Remember MINASWAN :)
<baweaver>
It's easy to be critical, I get that
<baweaver>
I certainly was for years, just made me kinda bitter all the time
<twb>
The part I'm really cranky about is they've got an ORM, and they're *still* constructing SQL queries by concatenating strings together
<baweaver>
are there any injections?
<baweaver>
Also make sure tests are around before moving the world
<baweaver>
Sometimes an assumption is made that does bad things that a test may reveal
<baweaver>
Been caught by that more times than I want to admit
<twb>
Actually since I'm completely new to ruby, is there a standard linter? Equivalent of perlcritic or python3 -m flake8
<baweaver>
Give it a week or so
<baweaver>
Penelope Phippen was working on one they're releasing at RubyConf next week
<twb>
Preferably something that will report both "this is a poor style" and "this is an actual security issue"
<twb>
baweaver: OK fair enough
<baweaver>
Currently Rubocop and Brakeman
<baweaver>
Rubocop will also autocorrect some issues
<baweaver>
I'll be speaking there again this year :D
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<twb>
Hrm, so now THIS method is calling "MichaelsMailer.deliver_gfk_weekly_report". And I can see "MichaelsMailer", but the "deliver_gfk_weekly_report" doesn't exist *anywhere else* in the codebase
<twb>
Doesn't even appear anywhere else in git history
<twb>
I can't obviously see it being constructed by reflection, either.
schne1der has joined #ruby
<twb>
MichaelsMailer has a "def gfk_weekly_report" which is constructing the message payload, though, so that must turn into "deliver_gfk_weekly_report"... somehow
lineus has quit [Ping timeout: 276 seconds]
jmcgnh has quit [Read error: Connection reset by peer]
<baweaver>
though it's probably AM defining that dynamically
<twb>
You mean like "just ask the runtime where the code came from" ?
Intelo_ has joined #ruby
<baweaver>
Pretty much
<twb>
I'm a bit scared to actually execute this code; they don't have a test environment or anything >_>
<baweaver>
&>> Integer.method(:+).source_location
<rubydoc>
stderr: -e:4:in `method': undefined method `+' for class `#<Class:Integer>' (NameError)... check link for more (https://carc.in/#/r/80ay)
<twb>
Also the broken code I'm trying to repair is the code that buys parts on credit, so if I *do* get it working, I very definitely do not want to re-run it a bunch of times :-)
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sandstrom has quit [Quit: My computer has gone to sleep.]
DTZUZO has quit [Ping timeout: 268 seconds]
akemhp_ has joined #ruby
queip has joined #ruby
akemhp has quit [Ping timeout: 245 seconds]
DTZUZO has joined #ruby
akem__ has joined #ruby
akemhp_ has quit [Ping timeout: 265 seconds]
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #ruby
queip has quit [Ping timeout: 240 seconds]
NL3limin4t0r_afk is now known as NL3limin4t0r
queip has joined #ruby
DTZUZO has quit [Ping timeout: 246 seconds]
<NL3limin4t0r>
rapha: Why isn't #respond implemented on Paren? It could simply be an empty method, that can be overridden by it's childs. That way you don't have to check if the method exists, and would be similar to #method_added. All classes modules have an empty method #method_added that is called when a method is added, however the default behaviour simply does nothing.
akemhp_ has joined #ruby
DTZUZO has joined #ruby
akem__ has quit [Ping timeout: 268 seconds]
roadt has joined #ruby
titanbiscuit has quit [Read error: Connection reset by peer]
titanbiscuit has joined #ruby
DTZUZO has quit [Ping timeout: 245 seconds]
DTZUZO has joined #ruby
andikr has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
akem__ has joined #ruby
akemhp_ has quit [Ping timeout: 268 seconds]
bsdbandit-01 has joined #ruby
bsdband81 has quit [Ping timeout: 268 seconds]
skx86 has joined #ruby
sandstrom has joined #ruby
sandstrom has quit [Ping timeout: 246 seconds]
sandstrom has joined #ruby
sandstrom has quit [Client Quit]
akemhp has joined #ruby
schne1der has quit [Ping timeout: 265 seconds]
DTZUZO has quit [Ping timeout: 276 seconds]
akemhp_ has joined #ruby
ElFerna has joined #ruby
DTZUZO has joined #ruby
akem__ has quit [Ping timeout: 240 seconds]
sandstrom has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
<rapha>
NL3limin4t0r: because i want multiple subclasses and they should each implement their own version of #respond
<rapha>
oh you mean, just implement it on the parent _in addition_
chalkmonster has joined #ruby
<rapha>
yes, that sounds nice!
chalkmonster has quit [Client Quit]
Nicmavr has quit [Read error: Connection reset by peer]
Inline has quit [Quit: Leaving]
bsdband6 has joined #ruby
bsdbandit-01 has quit [Ping timeout: 246 seconds]
Nicmavr has joined #ruby
ElFerna has quit [Quit: WeeChat 1.9.1]
akem__ has joined #ruby
akemhp_ has quit [Ping timeout: 240 seconds]
DaRock has quit [Ping timeout: 265 seconds]
cthu| has joined #ruby
akemhp has joined #ruby
akem__ has quit [Ping timeout: 268 seconds]
cthulchu_ has quit [Ping timeout: 245 seconds]
akemhp_ has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
codefriar has quit [Ping timeout: 240 seconds]
akemhp_ has quit [Ping timeout: 246 seconds]
akemhp has joined #ruby
DaRock has joined #ruby
conta has quit [Remote host closed the connection]
lucasb has joined #ruby
schne1der has joined #ruby
DaRock has quit [Ping timeout: 268 seconds]
AJA4350 has joined #ruby
DaRock has joined #ruby
sarink has joined #ruby
sarink has quit [Ping timeout: 265 seconds]
jottr has quit [Ping timeout: 240 seconds]
conta has joined #ruby
jottr has joined #ruby
_dbugger has joined #ruby
dbugger has quit [Ping timeout: 250 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 has quit [Ping timeout: 250 seconds]
AJA4350 has joined #ruby
xco has joined #ruby
rwb has quit [Ping timeout: 265 seconds]
queip has quit [Quit: bye, freenode]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
queip has joined #ruby
<NL3limin4t0r>
rapha: Yep, simply `def respond; end` would be enough.
<NL3limin4t0r>
Then you could change `respond if respond_to? :respond` to simply `respond`.
AJA4351 has joined #ruby
<NL3limin4t0r>
basically a noop method
andikr has quit [Remote host closed the connection]
AJA4350 has quit [Ping timeout: 276 seconds]
tpanarch1st_ has joined #ruby
AJA4351 has quit [Ping timeout: 240 seconds]
AJA4350 has joined #ruby
griffindy has joined #ruby
codefriar has joined #ruby
griffindy has quit [Client Quit]
codefriar has quit [Client Quit]
Jonopoly has joined #ruby
AJA4351 has joined #ruby
codefriar has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4350 has joined #ruby
AJA4351 has quit [Ping timeout: 246 seconds]
sandstrom has quit [Quit: My computer has gone to sleep.]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sandstrom has joined #ruby
sarink has joined #ruby
xco has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
rbruchal has joined #ruby
baojg has joined #ruby
baojg has quit [Remote host closed the connection]
rbruchal has quit [Client Quit]
animo8 has joined #ruby
schne1der has quit [Ping timeout: 265 seconds]
<animo8>
Hi, how do you handle a program being ran without arguments in optparse?
<animo8>
It makes sense to me that printing the help message should be the default action for no arguments, as opposed to showing an error
<animo8>
But whatever, I'll just implement it myself once I figure out how to handle the 0 args case
<phaul_>
depends on the program you are writing I guess. some programs require cmd line arguments some have some default behaviour.
AJA4350 has joined #ruby
<phaul_>
if you execute 'git' on the cmd line you get a list of sub-commands. If you do 'cat' it reads stdin
animo8 has quit [Ping timeout: 252 seconds]
guardian has quit [Ping timeout: 246 seconds]
* phaul_
wants his answer back :)
crella133 has joined #ruby
ElFerna has joined #ruby
alfiemax has quit [Remote host closed the connection]
guardian has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
crella133 has quit [Client Quit]
animo8 has joined #ruby
<animo8>
phaul_: Yeah, but IMO the most common case (and a good default behavior) is simply printing the help. Or maybe if there are subcommands print those
<animo8>
stdin reading should be something you explicitly implemented
<animo8>
But even if I did want to implement it I can't figure out how to do it using optparse :p
Intelo_ has quit [Ping timeout: 276 seconds]
AJA4350 has joined #ruby
bsdband6 has quit [Read error: Connection reset by peer]
<al2o3-cr>
animo8: check if argv is empty before parsing options.
<animo8>
al2o3-cr: I guess that works but it feels kinda clunky. Also I'd have to copy-paste my help string and that's not DRY
<al2o3-cr>
animo8: you don't, you just ARGV << '-h'/'--help' if ARGV.empty?
bsdband42 has joined #ruby
<animo8>
al2o3-cr: Ohhhhh, right. That's neat
ElFerna has quit [Quit: WeeChat 1.9.1]
ElFerna has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
ElFerna has quit [Quit: WeeChat 1.9.1]
sarink has quit [Remote host closed the connection]
AJA4350 has joined #ruby
bsdbandit-01 has joined #ruby
bsdband42 has quit [Ping timeout: 240 seconds]
cthulchu_ has joined #ruby
jottr has quit [Ping timeout: 268 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cthu| has quit [Ping timeout: 250 seconds]
brendan- has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
chalkmonster has joined #ruby
Swyper has joined #ruby
<Swyper>
gem "loofah", ">= 2.3.1"how do I run this in a ruby folder but with the --conservative option?like I want to upgrade my current gemfile to use Loofah 2.3.1
DaRock has quit [Ping timeout: 268 seconds]
schne1der has joined #ruby
vondruch has quit [Ping timeout: 245 seconds]
krawchyk has joined #ruby
Swyper has quit [Remote host closed the connection]
bsdband82 has joined #ruby
bsdbandit-01 has quit [Ping timeout: 265 seconds]
Swyper has joined #ruby
Esa_ has joined #ruby
<Swyper>
hi sorry I got logged out
poontangmessiah has joined #ruby
<Swyper>
bundle update loofah, how do I make this do a specific version i guess?
ravenousmoose has joined #ruby
infinityfye has quit [Quit: Leaving]
harai has joined #ruby
ravenousmoose has quit [Ping timeout: 250 seconds]
jottr has joined #ruby
Swyper has quit [Remote host closed the connection]
Navred has joined #ruby
animo8 has quit [Remote host closed the connection]
greengriminal has joined #ruby
howdoi has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.6]
spacesuitdiver has joined #ruby
conta has quit [Ping timeout: 268 seconds]
Nicmavr has quit [Ping timeout: 245 seconds]
brool has joined #ruby
queip has quit [Ping timeout: 268 seconds]
davidw has joined #ruby
davidw has joined #ruby
davidw has quit [Changing host]
akemhp_ has joined #ruby
jottr has quit [Ping timeout: 265 seconds]
akemhp has quit [Ping timeout: 265 seconds]
rainmanj_ has quit []
queip has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
krawchyk has quit [Quit: krawchyk]
darkf has quit [Quit: Connection closed for inactivity]
<adam12>
I wonder what it would take to offer pre-built Ruby versions (by Ruby core not RVM) similar to how all Nodejs versions have a pre-built Linux version.
roadt has quit [Ping timeout: 265 seconds]
<adam12>
I'm presuming it might have something to do with the Ruby options around compilation storing run paths (--enable-load-relative et all)
<havenwood>
"Furthermore, the Ruby core team does not want to be responsible for certain aspects, such as distributing binaries. But binaries are valuable. So we take up the responsibility of packaging binaries."
<NL3limin4t0r>
My snippet might return the ancestors in the wrong order, but that can be easily fixed.
phaul_ has joined #ruby
<havenwood>
NL3limin4t0r: I'd not expect that to work. Show an example? I typically stay away from recursion in Ruby, since I don't like to have it blow up with you get enough nodes.
<havenwood>
NL3limin4t0r: Enumerator::produce is new in Ruby 2.7
dinfuehr has joined #ruby
<NL3limin4t0r>
havenwood: Why would you expect it not to work?
<havenwood>
NL3limin4t0r: I was just thinking a very long Node chain. You're right, it passes the tests. :)
<havenwood>
NL3limin4t0r: You're also right the order is backwards. We need a #>> operator. :P
sarink has joined #ruby
<havenwood>
NL3limin4t0r: I like #prepend better than #unshift.
davidw has quit [Ping timeout: 265 seconds]
dinfuehr has quit [Ping timeout: 240 seconds]
<havenwood>
NL3limin4t0r: It does read nicely:
<havenwood>
parent.ancestors.prepend parent
dinfuehr has joined #ruby
sandstrom has quit [Ping timeout: 252 seconds]
al2o3-cr has quit [Remote host closed the connection]
al2o3-cr has joined #ruby
<NL3limin4t0r>
havenwood: I was going to say, you could use `[parent] + parent.ancestors` but that creates unesesary arrays. `parent.ancestors.prepend(parent)` is better.
<NL3limin4t0r>
I find that recursion generally makes code more readable, but maybe that's just me. Putting together a recursive method can be hard, but understanding them generaly isn't.
<havenwood>
NL3limin4t0r: Yes, that was one I considered. I just wanted to show off the new Ruby 2.7 feature. :P
dinfuehr has joined #ruby
<NL3limin4t0r>
ah
rippa has joined #ruby
<NL3limin4t0r>
I'll have a look though, Enumerator::produce seems interesting. There might be a solid use-case for making it in. Knowing matz you first need a real world usecase behore he even considers a feature.
<havenwood>
NL3limin4t0r: Updated with a test to trigger SystemStackError with recursive.
<NL3limin4t0r>
havenwood: What's the Ruby recursion limit?
<havenwood>
NL3limin4t0r: Just a handy way to make infinite enumerators. StopIteration examples are the edgecase.
<havenwood>
NL3limin4t0r: It depends on the stack level allowed, which is implementation specfiic.
phaul_ has quit [Ping timeout: 246 seconds]
bitwinery has joined #ruby
<havenwood>
NL3limin4t0r: JRuby's is on the small end, iir.
bitwinery has quit [Remote host closed the connection]
bitwinery has joined #ruby
<havenwood>
NL3limin4t0r: TCO is interesting. I'd kinda like to make it a bit more accessible to enable in Ruby.
<NL3limin4t0r>
I still find it kindof strange, since a while loop is simply user managed recursion. However I also get it, since Ruby tracks things like callee, stacktrace and other stuff, which doesn't happen when you do a while loop.
<NL3limin4t0r>
Or at least, it resets after each iteration.
dinfuehr has quit [Ping timeout: 276 seconds]
<al2o3-cr>
you can increase the stack size with RUBY_THREAD_VM_STACK_SIZE environment variable
<adam12>
havenwood: I find it interesting that Hongli is doing Fullstaq but not under the Phusion banner. Not to be a conspiracy theorist but I wonder if there's something more there.
<NL3limin4t0r>
al2o3-cr: that's pretty usefull to know =)
<adam12>
havenwood: Maybe it's just another brand.
<al2o3-cr>
NL3limin4t0r: indeed.
jacargentina has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 240 seconds]
ellcs1 has joined #ruby
<NL3limin4t0r>
It's getting late, I'm gonna let myself out. Have a nice day #ruby. =)
<al2o3-cr>
o/
NL3limin4t0r is now known as NL3limin4t0r_afk
davidw has joined #ruby
drincruz_ has joined #ruby
ravenousmoose has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
droid85 has joined #ruby
droid85 has quit [Quit: droid85]
<havenwood>
adam12: I noticed the same. They're both Dutch.
akemhp_ has joined #ruby
<havenwood>
adam12: Maybe just Dutch collaberation?
<adam12>
havenwood: Possibly. Phusion has such a strong brand it just surprised me.
<adam12>
havenwood: Still didn't see a tarball download. Oh well.
akem__ has quit [Ping timeout: 268 seconds]
<adam12>
havenwood: They could probably be extracted from the Heroku buildpack if one tried hard enough.
<phaul>
btw I don't like reusing localvariables like that Ijust wanted to demonstrate the idea of a event method that takes a block
<phaul>
def event(event_name, &block) ...
<yoshie902a>
interesting
<phaul>
you can even move it out into a module/concern, and include it with include Eventable and push on an @event instance variable
<yoshie902a>
I would need to set the event after the &block runs, but it’s doable.
<phaul>
yield first, then push. yes
jenrzzz has quit [Ping timeout: 268 seconds]
<phaul>
well, you can try it and see how you like the looks of it. experimenting is the best way
<yoshie902a>
what’s the real benefit of creating an eventable module? Or should it be a seperate instance?
<yoshie902a>
class
<yoshie902a>
I hate the size of it, but not sure how to reduce it, since I already moved most of the logic into the other methods
<phaul>
the benefit is that it's a concept that you can talk on it's own, a single responsibility part,that then doesn't polute you business logic (it does but it'sclearer that it doesnt belong to the business logic)
<yoshie902a>
makes sense
<yoshie902a>
how about handing the rollback on error? I feel this is really a messy way of doing it
al2o3-cr has quit [Remote host closed the connection]
<phaul>
if you have failable steps it might be a nice way to code it
al2o3-cr has joined #ruby
<yoshie902a>
When it does “Each operation shouldn’t accumulate state, instead it should receive an input and return an output without causing any side-effects.”
<yoshie902a>
Does it mean my events logic is accumulating state?
<yoshie902a>
I would not know how to roll back all the needed changes otherwise.
<phaul>
I think dry-transaction wants you to do this is a pipeline where each step gets its input from the result of the previous step, and if something fails in the pipeline the execution is aborted altogether. If you let's say save things in the database (side-effects) then it wouldn't work. But you are encouraged not to do that. So roll back is not needed.
<phaul>
once the pipeline executed sucessfully you can persist the results
<phaul>
(of the last step, but you can pass through stuff from previous steps)
<yoshie902a>
phaul: I am hitting an external API, and only know if things fail or succeed based on the api response, so it makes this method hard to do
<phaul>
ok, forget this then
schne1der has quit [Ping timeout: 250 seconds]
<yoshie902a>
for example, I update a subscription to the api, it succeeds, which then allows me to create an invoice, if that succeeds, the api lets me pay the invoice
<yoshie902a>
My db and the api should be inline, so if the api succeeds, it a good time to also update the DB
<yoshie902a>
however, if payments fails, I need to revert the update to the subscription, revert the db change
<yoshie902a>
and cancel the invoice
<phaul>
right. so the sole purpose of the events array is to know what to roll back on failure. I get it now.
duderonomy has joined #ruby
<yoshie902a>
Yup
<phaul>
I didn't understand that bit before
<yoshie902a>
I am just so unhappy with this method.
<yoshie902a>
it feels messy and just bad
<phaul>
I would be too. totally agree
<yoshie902a>
However, I do not know what else to do
harai has joined #ruby
<phaul>
tbh now that Iunderstand what you are doing I wouldn't recommend my first recommendation any more, I thought collecting events was a higher level system requirement
<phaul>
so scratch the event method with the block
<yoshie902a>
ok
<yoshie902a>
phaul: I’m open to all ideas :)
<phaul>
I probably would have 4 methods for the 4 steps: def update_api; ...; true ; rescue StripeError => undo_update; false; end and then update_api and update_db and ...
<phaul>
the event collecting feels bad. this still doesn't feel right but better (to me)
<phaul>
it's kind of similar to doing it with dry-transaction where you would have a rescue in each step
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul>
and fail the step if exception was raised, and that also aborts the pipeline
ellcs1 has quit [Ping timeout: 245 seconds]
<phaul>
so you are not passing the result of the steps just an ok status
rwb has joined #ruby
<phaul>
but it's mostly emulated by a method per step where each method rescues, and returns true if there was no exception wasn't
<yoshie902a>
the problem is if the last step fails, they all need to be rolled back
<yoshie902a>
if I understand you, only the last step gets rolled back
<yoshie902a>
Am I misunderstanding you?
<phaul>
no. you are right
greengriminal has joined #ruby
greengriminal has quit [Client Quit]
akemhp has joined #ruby
jenrzzz has joined #ruby
Inline has joined #ruby
imtravis has joined #ruby
<yoshie902a>
I think I am going to change the way I use the api, charge the customer first and if successful, then update the subsciption
sputnik13 has joined #ruby
ellcs1 has joined #ruby
bvdw has quit [Quit: bvdw]
bvdw has joined #ruby
jenrzzz has quit [Ping timeout: 276 seconds]
Technodrome has joined #ruby
<yoshie902a>
phaul: Thank you for your feedback!
jenrzzz has joined #ruby
entel has quit [Quit: Connection closed for inactivity]
sputnik13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nisstyre has quit [Quit: WeeChat 2.5]
sputnik13 has joined #ruby
yoshie902a has quit [Quit: yoshie902a]
sputnik13 has quit [Client Quit]
nisstyre has joined #ruby
sputnik13 has joined #ruby
phaul_ has joined #ruby
sputnik13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
VeryBewitching has quit [Quit: Konversation terminated!]
phaul_ has quit [Ping timeout: 245 seconds]
bambanx has joined #ruby
spacesuitdiver has quit [Ping timeout: 240 seconds]
sputnik13 has joined #ruby
sameerynho has quit [Ping timeout: 276 seconds]
sputnik13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ellcs1 has quit [Remote host closed the connection]