<aesthetikx>
looking pretty good lester29. You may want to use 'next' right after the invalid choice print so that it doesnt run the print result line
<aesthetikx>
also, not sure what the purpose of the range parts are, doesnt' seem to be used
<lester29>
i added ranges because i thought they might be useful in future
<aesthetikx>
lastly, you could probably use exceptions better, e.g. you print an error for entering an invalid number, but then end up returning nil, and then the program continues on
eddof13 has quit [Client Quit]
<lester29>
should i move read_number to the case when?
<lester29>
i want to avoid checking if number is zero in the division
<lester29>
hmm what do you think about catching ZeroDivisionError?
<lester29>
is `break if user_choice == 5` a good way to exit the loop if user's choice is to quit program?
<aesthetikx>
pretty good, you can also 'exit if ....'
<lester29>
oh i forget ZeroDivisionError is not throwed in float operations
<lester29>
in python i did special class like Menu which contained menu items together with its names and bound functions
<lester29>
in ruby i have to learn fundamentals first like oop, lambdas, procs
<lester29>
actually i can do solutions like i presented in above code
<lester29>
my menu app in the python was more complete
<lester29>
the reason why i switched from python to ruby is that ruby is pleasant for me, is it a good reason?
<lester29>
to python i had to force myself to program in it
<aesthetikx>
ruby is much better than python imo
<aesthetikx>
keep at it you are doing well
<aesthetikx>
I would say ZeroDivisionError is a good candiate for like wrapping your main loop with, and having that just print out a message and then continuing on to the next loop
<lester29>
I can raise ZeroDivisionError when second number is 0
<lester29>
should I remove range feature? I added it because I found it might be useful in future
<lester29>
should I add to my program features that I think they might be useful in the future?
<aesthetikx>
generally you want to keep it simple until you have a reason not to
<aesthetikx>
but if you are experimenting it is ok
<lester29>
I can't wait learning rails, I want to make my personal website from scratch in the RoR
Sankalp has quit [Ping timeout: 250 seconds]
Sankalp has joined #ruby
ados30 has joined #ruby
<aesthetikx>
that will be fun
gh0st6 has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
caedmon has joined #ruby
caedmon has quit [Client Quit]
caedmon has joined #ruby
caedmon has quit [Read error: Connection reset by peer]
caedmon has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
diagnostics0 has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 245 seconds]
caedmon has quit [Ping timeout: 246 seconds]
buckwheatsuperpo has joined #ruby
diagnostics0 has quit [Remote host closed the connection]
diagnostics0 has joined #ruby
diagnostics0 has quit [Remote host closed the connection]
buckwheatsuperpo has quit [Ping timeout: 246 seconds]
<johnjaye>
it surprises me to know rails and ruby are different
<johnjaye>
in colloquial speech they're usually identified. as in, 'ruby on rails'
<johnjaye>
i got into ruby because someone I know uses it and he doesn't use rails at all
anthony_ has joined #ruby
<ox1eef_>
Rails is popular in the job market. More so than vanilla Ruby.
johnjaye has quit [Ping timeout: 264 seconds]
johnjaye has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 246 seconds]
<lester29>
working as ruby developer and as hobby coding in elisp, fun with emacs would satisfy my life
<lester29>
in my city a ruby jobs are well-paid
<johnjaye>
hail fellow emacs enthusiast and ruby enjoyer
<johnjaye>
i too enjoy the lisp like features of ruby. or i'm trying to learn anyway
<lester29>
:)
<lester29>
i have doubts whether university gives something other than paper
caedmon has joined #ruby
<lester29>
i'm computer science student
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 260 seconds]
caedmon has quit [Ping timeout: 246 seconds]
ados30 has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 260 seconds]
caedmon has joined #ruby
gh0st6 has quit [Quit: Connection closed for inactivity]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 252 seconds]
desnudopenguino1 is now known as desnudopenguino
_ht has joined #ruby
caedmon has quit [Ping timeout: 260 seconds]
keypresser86_ has quit []
<libsys>
hello people... question, how do I set environment variables within a rake task?
<libsys>
If I do set an env var within a rake task it gets set on every interaction I have with rake, not to an specific task
<libsys>
hmm... looks like that only happens when I do use an specific syntax... will be back
<libsys>
well.. it seems like if I do set an env var within `Rake::TestTask.new do |t|` it becomes triggered always, but if I do define a `task :something`, it doesnt
<libsys>
it makes sense, because it needs to execute the block in order to know the test task exists
<libsys>
should I enclose the test task within an external test task then?
<libsys>
I guess the question is: how to execute a code when the task is being triggered, and not when it's being defined
<libsys>
seems hackish, if you know a better way plz let me know
buckwheatsuperpo has joined #ruby
grenierm has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 250 seconds]
Linux_Kerio has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
grenierm has quit [Quit: Client closed]
_ht has quit [Quit: _ht]
grenierm has joined #ruby
grenierm has quit [Client Quit]
Sankalp has quit [Ping timeout: 246 seconds]
<libsys>
gals... how do you unit test your sequel models? do you mock the database conection? do you have some tests to share so I can see your approach? thanks!
roadie has joined #ruby
Sankalp has joined #ruby
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 246 seconds]
hrberg has quit [Quit: No Ping reply in 180 seconds.]
hrberg has joined #ruby
nark89 has joined #ruby
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 252 seconds]
nark89 has quit [Remote host closed the connection]
nark89 has joined #ruby
sagax has quit [Ping timeout: 245 seconds]
matoro has quit [Ping timeout: 246 seconds]
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 245 seconds]
nark89 has quit [Remote host closed the connection]
desnudopenguino has quit [Remote host closed the connection]
desnudopenguino has joined #ruby
patrick- has quit [Ping timeout: 245 seconds]
patrick- has joined #ruby
buckwheatsuperpo has joined #ruby
roadie` has joined #ruby
roadie has quit [Ping timeout: 255 seconds]
royo25 has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 250 seconds]
Linux_Kerio has joined #ruby
momo- has left #ruby [#ruby]
Guest26nakilon has joined #ruby
<Guest26nakilon>
can't find any example of a syntax to document such thing not in one line but in several because it becomes tedious to follow/edit # @return [Array(Integer, Integer, Integer, String, String, Integer, String, String)] timestamp1, timestamp2, qwe, qwe, qwe, qwe, qwe in base64, qwe
<Guest26nakilon>
IIRC I tried YARD
markong has joined #ruby
royo25 has quit [Quit: Bye]
matoro has joined #ruby
<nona>
interesting. i just noticed that it's entirely possible to have older gems installed than what would be possible/permitted by Gemfile.lock.
heartburn has quit [Ping timeout: 240 seconds]
finsternis has quit [Ping timeout: 246 seconds]
finsternis has joined #ruby
heartburn has joined #ruby
desnudopenguino has quit [Remote host closed the connection]
desnudopenguino has joined #ruby
Linux_Kerio has quit [Quit: Konversation terminated!]
Linux_Kerio has joined #ruby
<adam12>
libsys: I don't mock the database connection for my Sequel tests. But I do wrap everything in a transaction for automatic rollback.
<adam12>
libsys: (or I use Sqlite in-memory if that's the adapter I'm using)
<fakenullie>
for models unit tests transaction with rollback should work. For integration tests with several transactions you can clear database before or after test
user23 has joined #ruby
gonix has joined #ruby
user23 has quit [Ping timeout: 246 seconds]
gonix has quit [Ping timeout: 240 seconds]
Guest26nakilon has quit [Quit: Client closed]
buckwheatsuperpo has quit [Ping timeout: 245 seconds]
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 240 seconds]
<desnudopenguino>
adam12: thank you for the working example for the roda inject_erb plugin! i agree extracting the code out to a separate class would be my way of using it, but i was just following along with the guide, and the author kind of leaves the reader to figure out some pieces occasionally.
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 245 seconds]
<adam12>
desnudopenguino: I forgot you were using the guide. I think it predates when I started using Roda.
buckwheatsuperpo has joined #ruby
<adam12>
Ah yes, I see the example now. Having comments above the code blocks to indicate which file to place them in would probably help. I guess it's assuming you'd instictively place it in `app.rb` but that's not necessarily true in the case of erb files which could _technically_ accept a method definition.
<adam12>
In my case, the example I provided was from best practive I've come to do after using Roda since ~ 2015. I find on larger applications, everything dropped inside the Roda subclass to be very unfortunate. Some things are appropriate there, but a lot of things are likely better off in their own class.
<desnudopenguino>
ah. yeah organization like that can be tough. they probably tried to shoe-horn everything into one pattern for the sake of "simplicity" at some level
buckwheatsuperpo has quit [Ping timeout: 240 seconds]
<adam12>
That's the problem I've found with my larger Roda apps.
<adam12>
(my largest Roda app is currently 75kLOC)
<nona>
hmm
passbe has quit [Quit: bye...]
passbe has joined #ruby
<nona>
how do we feel about `lambda` vs `->`? "use the newer one" or "the newer one is too cryptic, write it out"?
<adam12>
nona: I use them all interchangably. I don't think it really matters.
<adam12>
nona: I do actually like the longhand, since it preserves block arguments in a familiar manner, but if I am not explicitely thinking about it I just put whatever I want there.
<desnudopenguino>
that's a pretty sizeable project!
<adam12>
desnudopenguino: In some ways it seems fairly small, but for a good portion of the project there were no advanced Rubyists on it, so I spend a lot of time fixing architecture flaws as well as feature work.
<adam12>
I'm using my own "framework" on personal projects that is not Roda (and I removed Roda from most personal projects) as it turns out I miss classes/objects/Ruby code. In some ways, Rails got this right (but ActiveRecord makes me unhappy).
<nona>
adam12: oh, so you also don't worry about your code being inconsistent in that it uses either one or the other?
<desnudopenguino>
ah
<adam12>
nona: Not really. I've written enough Roda to be super familiar with it (I'm #5 in top contributors tho that doesn't mean much).
<adam12>
nona: What's more important to me is developer ergonomics on teams, and I've found over the years that everyone struggles with the routing tree. I spend so much time explaining it, and explaining how to keep it shallow / understandable.
<desnudopenguino>
i've been web framework testing trying to find something that fits my needs. used to run rails, but it seems to keep growing and i don't always need everything it offers. messed with Sinatra for a little, and my 9-5 is in PHP for the most part
<nona>
Huh, what does lambda vs -> have to do with Roda, adam12
<nona>
no, and i'm wondering if a bikeshed is a bicycle repair shop. i'm not a native speaker of English fwiw and have been trained in British, not American English, at school.
* nona
goes to read
<adam12>
nona: Oooh. I see.
<adam12>
That link is actually not that great, looking at it.
<adam12>
(I thought it was better, in memory).
<nona>
hmm it seems a bike shed is a place where you store bikes, not where you repair them
<nona>
and the topic seems to be about personal preferences in software development
buckwheatsuperpo has joined #ruby
<adam12>
The context is: you're designing a nuclear power station. The room has 40 people in it, all top level people. Everyone needs to look important to their bosses and bosses bosses. How's the nuclear fission design? good, everyone nods (only 2 people understand it). How about the water containment? good, everyone nods (only 1 person understands it).
<adam12>
The bike shed on the property? wrong colour, wrong size, wrong roof, not the right size, because everyone in the room can understand what a bike shed may or may not be.
<adam12>
So the idea is that everyone has an opinion on trivial matters, because they don't want to be left out or look ignorant.
<nona>
i like your explanation though
<adam12>
Bike shedding about line length is an easy one. But really, what _is_ the difference between -> and lambda? A lot of Ruby devs probably don't know, so wouldn't argue for/against.
<nona>
and i've definitely been guilty of being one of those people ... thank you for the opportunity for self-reflection here :D <3
<adam12>
LOL
<adam12>
Just remember that software development is all about tradeoffs.
<adam12>
Probably why line length doesn't matter. If I trade off a longer line in respect for better understanding of that particular line, then it's a win.
<adam12>
If I had to split it at 80 characters because of some arbitrary rule, and that hurt readability (which we do a lot more than writing code), then that would be not ideal.
<nona>
otoh it also legitimises the development of something we might call "team culture" or somesuch thing
<adam12>
That is indeed a better article on 'the bike shed'.
<adam12>
Definitely try standard if you haven't already. It's a more forgiving rubocop.
buckwheatsuperpo has quit [Ping timeout: 264 seconds]
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 250 seconds]
<sphex>
wait, is there a semantic difference between -> and lambda? I thought it was different syntax for the same thing (unlike proc, which is different).
buckwheatsuperpo has quit [Ping timeout: 240 seconds]
markong has quit [Ping timeout: 245 seconds]
_ht has joined #ruby
TomyWork has quit [Remote host closed the connection]
<adam12>
sphex: No, there's not :)
<adam12>
sphex: Other than the way block arguments are passed.
m_antis has quit [Ping timeout: 245 seconds]
<adam12>
Tho the instruction sequence _is_ different.
<adam12>
putself vs putspecialobject (lambda vs ->)
roadie` is now known as roadie
<adam12>
the send looks the same
<adam12>
I wonder if there's a performance hit with those two instruction sequence differences.
buckwheatsuperpo has joined #ruby
<sphex>
adam12: ohhh it's because #lambda can be overridden right?
<adam12>
sphex: Ooh maybe. I never considered that, but yes, likely. #lambda isn't a keyword.
buckwheatsuperpo has quit [Ping timeout: 240 seconds]
<ox1eef_>
Awesome. Making more progress in the last 10 minutes than hours of debugging blind.
octobear has quit [Ping timeout: 245 seconds]
desnudopenguino has quit [Remote host closed the connection]
desnudopenguino has joined #ruby
Gerito5 has joined #ruby
caedmon has quit [Ping timeout: 246 seconds]
___nick___ has quit [Ping timeout: 250 seconds]
mexen has quit []
_ht has quit [Quit: _ht]
<ox1eef_>
And houston we have lift off ! Thanks everyone for the help.
<adam12>
Nice!
<adam12>
I always forget that SimpleDelegator and Mocha don't play well together. I always have a grand plan of migrating something via SimpleDelegator then breaking a bunch of tests.
<ox1eef_>
=[
infinityfye has quit [Quit: Leaving]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 246 seconds]
roadie has quit [Ping timeout: 255 seconds]
roadie has joined #ruby
Gerito5 has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 255 seconds]
eddof13_ has joined #ruby
eddof13_ has quit [Ping timeout: 246 seconds]
dstein64- has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dstein64 has quit [Ping timeout: 252 seconds]
dstein64- is now known as dstein64
tomtmym has quit [Quit: Gone.]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
Thanzex has quit [Ping timeout: 252 seconds]
roadie has joined #ruby
markong has joined #ruby
roadie has quit [Ping timeout: 255 seconds]
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 245 seconds]
eddof13 has joined #ruby
roadie has joined #ruby
mweckbecker has quit [Ping timeout: 250 seconds]
mweckbecker has joined #ruby
fercell has quit [Ping timeout: 260 seconds]
roadie has quit [Ping timeout: 255 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
desnudopenguino has quit [Remote host closed the connection]
desnudopenguino has joined #ruby
markong has quit [Ping timeout: 245 seconds]
buckwheatsuperpo has joined #ruby
buckwheatsuperpo has quit [Ping timeout: 240 seconds]
user23 has quit [Remote host closed the connection]