<cxl>
Hi all, I'm trying to have a generic ApplicationError class that is easily extensible. So I came up with this: https://dpaste.org/ZifeE but the PageUpdateStateJob isn't happy with the retry_on:, the error is "ArgumentError: #<ApplicationError: ApplicationError> must be an Exception class or a String referencing an Exception class". However, when I run ApplicationError::PageNotReady.is_a? Exception, I get true.
<cxl>
Any ideas?
peirik__ has quit [Ping timeout: 260 seconds]
yosafbridge has quit [Quit: Leaving]
yella has quit [Ping timeout: 255 seconds]
SeaCreature102 has joined #ruby
yosafbridge has joined #ruby
<SeaCreature102>
Hey guys, I'm seeking a fair analysis of Ruby on Rails vs Django Web Dev Frameworks, please say opinions and experiences and analysis here.
grokify has joined #ruby
grokify has quit [Ping timeout: 255 seconds]
some14u has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
SeaCreature102 has quit [Ping timeout: 260 seconds]
some14u has quit [Client Quit]
ua_ has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #ruby
sixecho has quit [Quit: Bridge terminating on SIGTERM]
some14u has joined #ruby
wuming2[m] has quit [Quit: Bridge terminating on SIGTERM]
Alhamdulillah[m] has quit [Quit: Bridge terminating on SIGTERM]
tiziodcaio has quit [Quit: Bridge terminating on SIGTERM]
jhass[m] has quit [Quit: Bridge terminating on SIGTERM]
lutrinus has quit [Ping timeout: 248 seconds]
ua_ has joined #ruby
jhass[m] has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Sophira has quit [Ping timeout: 268 seconds]
Sophira has joined #ruby
royo25 has quit [Quit: Bye]
u0_a87 has joined #ruby
<FullMetalStacker>
@SeaCreature102: What will you want to use it for. This is the No1 question you should clear
<FullMetalStacker>
Generic analyses are of small value and if you seek those, you will find tons of them online in 1001 blog posts. IMHO most of them are failing because they don't compare the stacks for a specific use case. There is no one better for all, but the best tool for the specific goal. So tell us the goal and we can help
sixecho has joined #ruby
tiziodcaio has joined #ruby
Alhamdulillah[m] has joined #ruby
wuming2[m] has joined #ruby
<FullMetalStacker>
this goal should not only contain the technical specifications of some web app, but also why you want to learn/use those web stacks should you be someone who asks because he wants to know what to learn. learning goals are very important to chose the right way
aeris- has joined #ruby
_aeris_ has quit [Ping timeout: 255 seconds]
<adam12>
cxl: What happens if you pass it a string of the exception? "ApplicationError::PageNotReady"
<adam12>
cxl: Your solution is creative, but I'd probably punt on the meta programming and just create the subclasses I want.
peirik__ has joined #ruby
alexherbo2 has quit [Ping timeout: 260 seconds]
supay has quit [Quit: Connection closed for inactivity]
aeris- is now known as aeris
Laplace has quit [Quit: Connection closed for inactivity]
u0_a87 has quit [Ping timeout: 252 seconds]
<cxl>
adam12: Yeah, I thought it might be too clever
<cxl>
How do I get a module to autoload all *.rb files within a sub directory? Like I have './mymodule.rb' and I want it to load any rb file in './mymodule/*.rb' within the module? But without having to enumerate every single file, so that if I add a new class to that module in a new file, it will just get loaded into it.
<cartdrige>
cxl: use something like flist = Dir[*/*.rb]; flist.each(){ |f| load(f) }
<cartdrige>
not the exact syntax maybe, pseudocode, but that's the idea.
<cxl>
Ok, and then the files in `mymodule/lala.rb` must also include `module MyModule; class MyClass...` or can they simply be `class MyClass` without the module explicitly specified?
crax23 has joined #ruby
supay has joined #ruby
cartdrige has quit [Ping timeout: 246 seconds]
cartdrige has joined #ruby
Y05hito__ has joined #ruby
crax23 has quit [Ping timeout: 260 seconds]
<Y05hito__>
cxl, if the load() call is within the module definition it's probably not needed i'd say. However i'm not sure better test for it. But anyway, it's better to specify what module it belongs to
u0_a87 has quit [Ping timeout: 252 seconds]
<Y05hito__>
So that if you look at the file separatly you know what it is/what module etc.
alexherbo2 has joined #ruby
<cxl>
Y05hito__: Ok, got it
cartdrige has quit [Ping timeout: 260 seconds]
alexherbo2 has quit [Ping timeout: 260 seconds]
CrazyEddy has quit [Ping timeout: 255 seconds]
reset has joined #ruby
CrazyEddy has joined #ruby
crax23 has joined #ruby
CrazyEddy has quit [Ping timeout: 260 seconds]
crax23 has quit [Remote host closed the connection]
cartdrige has joined #ruby
Y05hito__ has quit [Ping timeout: 246 seconds]
CrazyEddy has joined #ruby
D_A_N_ has joined #ruby
Tempesta has quit [Quit: See ya!]
Tempesta has joined #ruby
lutrinus has joined #ruby
crax23 has joined #ruby
Y05hito__ has joined #ruby
cartdrige has quit [Ping timeout: 256 seconds]
ccapndave has joined #ruby
crax23 has quit [Ping timeout: 260 seconds]
lucerne has quit [Ping timeout: 256 seconds]
cartdrige has joined #ruby
cartdrige has quit [Max SendQ exceeded]
cartdrige has joined #ruby
Y05hito__ has quit [Ping timeout: 260 seconds]
gonix has joined #ruby
ccapndave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
u0_a87 has joined #ruby
ccapndave has joined #ruby
peirik__ has quit [Ping timeout: 252 seconds]
FullMetalStacker has quit [Remote host closed the connection]
grokify has joined #ruby
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
u0_a87 has quit [Ping timeout: 246 seconds]
tirnanog has joined #ruby
grokify has quit [Remote host closed the connection]
FullMetalStacker has joined #ruby
some14u has joined #ruby
grokify has joined #ruby
<cxl>
Does MyModel.counter.increment skip the model's callbacks? I know `increment!` does skip validations and callbacks, but not sure about `increment`.
ccapndave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ccapndave has joined #ruby
grokify has quit [Remote host closed the connection]
ccapndave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ccapndave has joined #ruby
ccapndave has quit [Client Quit]
<cxl>
adam12: What do you mean?
caedmon has quit [Ping timeout: 246 seconds]
<cxl>
meh, I think I have to rethink that part, because it's very possible that two jobs will run in parallel and try to update the counter at the same time, which means the count might end up being wrong
lucerne has joined #ruby
ccapndave has joined #ruby
ccapndave has quit [Client Quit]
<adam12>
cxl: Right. Doing it atomically means having the database do the update for you.
<adam12>
cxl: I don't know how to do it in ActiveRecord.
<_73>
If I say "foo = foo()", the variable foo is set to the return value of the foo() method. I get equivalent behavior if I say "bar = foo". However, if I say "foo = foo", then the variable is always set to nil. Why is this?
<leftylink>
because if there is a variable and a function of the same name, that name without parentheses is presumed to be the variable, instead of the function
<leftylink>
"and what happens when you assign `a` to `a` with `a` undefined"? (no it doesn't explain why it happens, it is just showing it)
<adam12>
I wonder if this will change on Ruby 3.2
<adam12>
Nope.
grokify has joined #ruby
grokify has quit [Remote host closed the connection]
alexherbo2 has joined #ruby
ur5us has joined #ruby
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp has joined #ruby
TomyWork has quit [Quit: Leaving]
FullMetalStacker has quit [Read error: Connection reset by peer]
walez has quit [Quit: Leaving]
cartdrige has joined #ruby
Y05hito__ has quit [Ping timeout: 252 seconds]
<leftylink>
though this part did not materially affect the talk, at the point of saying `a = b` then `a` was already defined, so "with `a` undefined" was not true at that particular point. but it's okay, that demonstration was still true, defined or not
<leftylink>
pandabot: rb begin; a = b; rescue; end; local_variables
<isene>
I am reading user input in the console with STDIN.gets , how can I supply a default value that the user can edit or add to if needed? Example, I want the user to enter a command, but give him "mkdir " as a default/ starting value. How?
<adam12>
isene: You'd need something more than gets. Maybe reline.
<adam12>
I'm not even sure you can provide a default/starting value to reline... hmm.
<isene>
Well, any trick will do, I guess
aeris has quit [Ping timeout: 255 seconds]
<isene>
I was first thinking that I could somehow force a string into STDIN, then do STDIN.gets and it should magically appear as if the user first entered that string. But nope.
<adam12>
Not that simple, unfortunately :P
aeris has joined #ruby
<adam12>
You might be able to simulate it, but you'd need to use io/console.
grokify has quit [Remote host closed the connection]
<isene>
How, if I may ask?
<adam12>
Well, just spitballing here, but if you use io/console, you can flip to raw mode. That can allow you to getc without it echoing to the screen.
<adam12>
So you'd have a loop of getc, where you compare the characters. You can check for escape, carriage-return, etc. When you read a character that's not one of them, you can print it to the screen.
<adam12>
And add it to your internal buffer.
<adam12>
To clear a character, you might have to send an ANSI sequence.
aeris has quit [Remote host closed the connection]
<isene>
Yeah, this is what I do with several of my ncurses applications. Trying to go simple than that with my xrpn project...
<isene>
Looking at readline now to see if that could do the trick.