yarou_ has quit [Quit: This computer has gone to sleep]
patrontechnosoft has joined #ruby
TheBloke has joined #ruby
patrontechnosoft has quit [Remote host closed the connection]
solocshaw1 has joined #ruby
solocshaw has quit [Ping timeout: 246 seconds]
solocshaw1 is now known as solocshaw
meinside has quit [Quit: Connection closed for inactivity]
Puffball has joined #ruby
elsevero has joined #ruby
jyaworski has joined #ruby
sarbs has quit [Ping timeout: 246 seconds]
Toledo has joined #ruby
Toledo is now known as croberts
sarbs has joined #ruby
s1kx has joined #ruby
sylario has joined #ruby
mim1k has joined #ruby
jyaworski has quit [Ping timeout: 240 seconds]
latemus has quit [Ping timeout: 248 seconds]
latemus has joined #ruby
mim1k has quit [Ping timeout: 255 seconds]
lxsameer has joined #ruby
xall has joined #ruby
latemus has quit [Ping timeout: 248 seconds]
latemus has joined #ruby
quobo has joined #ruby
mim1k has joined #ruby
Beams has joined #ruby
jyaworski has joined #ruby
Emmanuel_Chanel has quit [Read error: Connection reset by peer]
ketan has joined #ruby
jyaworski has quit [Ping timeout: 276 seconds]
vuoto has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
latemus has quit [Ping timeout: 276 seconds]
latemus has joined #ruby
ur5us has joined #ruby
workmad3 has quit [Quit: leaving]
workmad3 has joined #ruby
mim1k has joined #ruby
ledestin has joined #ruby
anisha has quit [Read error: Connection reset by peer]
jrm has quit [Ping timeout: 240 seconds]
anisha has joined #ruby
jrm has joined #ruby
jyaworski has joined #ruby
jyaworski has quit [Ping timeout: 260 seconds]
patrontechnosoft has joined #ruby
fusta has joined #ruby
patrontechnosoft has quit [Remote host closed the connection]
patrontechnosoft has joined #ruby
patrontechnosoft has quit [Read error: No route to host]
patrontechnosoft has joined #ruby
jrm has quit [Ping timeout: 248 seconds]
mim1k has quit [Ping timeout: 248 seconds]
nanoz has joined #ruby
patrontechnosoft has quit [Read error: Connection reset by peer]
mim1k has joined #ruby
patronte_ has joined #ruby
patronte_ has quit [Remote host closed the connection]
marr has joined #ruby
patrontechnosoft has joined #ruby
patrontechnosoft has quit [Remote host closed the connection]
patrontechnosoft has joined #ruby
patrontechnosoft has quit [Remote host closed the connection]
patrontechnosoft has joined #ruby
patrontechnosoft has quit [Read error: No route to host]
<_moep_>
hey, when I do bundle exec gem install unicorn I get an error. is it the common way to install unicorn?
vuoto has quit [Quit: Lost terminal]
mikecmpb_ has joined #ruby
mikecmpbll has quit [Ping timeout: 260 seconds]
jrm has joined #ruby
patrontechnosoft has joined #ruby
patrontechnosoft has quit [Remote host closed the connection]
<elomatreb>
_moep_: Depending on what the error is, you're probably just missing some development headers so it can't build the native extension
patrontechnosoft has joined #ruby
patrontechnosoft has quit [Remote host closed the connection]
patrontechnosoft has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<_moep_>
elomatreb: wait…
charliesome has joined #ruby
<_moep_>
the strange thing when I do bundle installed it installs unicorn
<elomatreb>
Also, just saw that, you don't call gem with bundle exec. If you want bundler to install unicorn you add it to the Gemfile
patrontechnosoft has quit [Remote host closed the connection]
<_moep_>
its added in the gemfile
vuoto has joined #ruby
patrontechnosoft has joined #ruby
<_moep_>
so I dont need to install it via gem`
<_moep_>
?
<elomatreb>
Yes, bundler does that for you (including selecting the right version according to the Gemfile.lock and your constraints)
patrontechnosoft has quit [Remote host closed the connection]
pandaant has joined #ruby
ferr has joined #ruby
<_moep_>
ok
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<_moep_>
and when I do bundle exec rake generate_secret_token
romankapitonov has joined #ruby
<_moep_>
I see in the logs something like DEPRECATION WARNING: You didn't set `secret_key_base`
<_moep_>
Read the upgrade documentation to learn more about this new config option. (called from load at /home/app/.rbenv/versions/2.3.4/bin/unicorn:22)
cyphase has joined #ruby
catphish has joined #ruby
TheBloke has quit []
cyphase has quit [Max SendQ exceeded]
cyphase has joined #ruby
patrontechnosoft has joined #ruby
cyphase has quit [Max SendQ exceeded]
cyphase has joined #ruby
sarbs has quit [Ping timeout: 246 seconds]
cyphase has quit [Max SendQ exceeded]
sarbs has joined #ruby
patrontechnosoft has quit [Read error: Connection reset by peer]
patrontechnosoft has joined #ruby
cyphase has joined #ruby
cyphase has quit [Max SendQ exceeded]
cyphase has joined #ruby
TheBloke has joined #ruby
patrontechnosoft has quit [Read error: No route to host]
cyphase has quit [Max SendQ exceeded]
patronte_ has joined #ruby
cyphase has joined #ruby
stamina has joined #ruby
brent__ has joined #ruby
cyphase has quit [Max SendQ exceeded]
patronte_ has quit [Remote host closed the connection]
patrontechnosoft has joined #ruby
brent__ has quit [Ping timeout: 260 seconds]
conall has joined #ruby
patrontechnosoft has quit [Ping timeout: 260 seconds]
<conall>
Hi. Lets say I have multiple version of a gem, one on each entry of my GEM_PATH. When I do a "gem <mygem>", will it take the first gem it sees on the path, or will it take the latest version of the gem? What if I want to prioritise gems on one path over the others, can I just puth that path first on GEM_PATH? Thanks
<dminuoso>
conall: Depending on what you do you either let your gemspec or your Gemfile (bundler) deal with versions.
mim1k has quit [Ping timeout: 246 seconds]
<dminuoso>
Do not try to manually fiddle around with versions, it will backfire.
<conall>
I guess I should explain my use-case. I basically want to say "if there is a certain directory on the system, use the gems from this directory, as they represent what will be on a production environment". Is this possible?
mim1k has joined #ruby
patrontechnosoft has joined #ruby
patrontechnosoft has quit [Read error: Connection reset by peer]
jyaworski has joined #ruby
<sylario>
conall > you are kind of trying to work against the purpose of bundler
<conall>
sylario. Yeah, perhaps it is not the best solution. Do you know how else I could do this?
<sylario>
conall: why eactly do you want to use the gem of production?
<sylario>
+s
<conall>
During my tests, I want to most accurately reflect the real-world conditions
<sylario>
bundler will take care of installing (thanks to gemfile.lock) exactly the gem used in dev .
<sylario>
In dev you can, in the gemfile, specify version of gems, and the exact versions of your gems are stored (even without indicating a version) in the .lock
<matthewd>
Yeah, this isn't working against bundler, it's reinventing bundler
pb122 has quit [Read error: Connection reset by peer]
<conall>
sylario: Grand, so I should just stick with the Gemfile.lock
heoau has joined #ruby
<sylario>
when you deploy, you are supposed to use bundler, so that your (eventually) new list of gems are deployed by bundler, so that your prod use the exact same gems
<sylario>
never edit gemfile.lock
jyaworski has quit [Ping timeout: 248 seconds]
<sylario>
use gemfile, bundler will update lock when updating/upgrading
<sylario>
don't upgrade if you do not have test covering all of your codebase
patrontechnosoft has joined #ruby
<heoau>
I installed Ruby Oauth from Gems. I use it currently from command promt, I would like to automate it, can I do this with Ruby somehow and which packages do I need to do this?
patrontechnosoft has quit [Remote host closed the connection]
<conall>
sylario: I am kind of working backwards here. So the environment (LogStash) I am working on already has a gemfile.lock, so I kind of want to make sure I use the same version of all of these gems
patrontechnosoft has joined #ruby
<sylario>
conall: when your app is in prod, just do bundle install
<sylario>
the prod will have the same gems
<conall>
sylario: Lets say I want to say "if a certain directory on the machine exists, use the Gemfile.lock from this directory. Can I do this?"
patrontechnosoft has quit [Remote host closed the connection]
<conall>
sylario: Theproblem is, the prod env is already locked down and I cannot so a bundle install
mikecmpb_ has quit [Quit: inabit. zz.]
<universa1>
conall: then your dev env should be the same.
patrontechnosoft has joined #ruby
<sylario>
yes, manually specify gem versions in the gemfile (not .lock)
<sylario>
but I would say your production is not really adapted to bundler
mikecmpbll has joined #ruby
patrontechnosoft has quit [Remote host closed the connection]
<conall>
sylario: My prod is pretty much set in stone, I cant change the versions etc. The problem is that there are currently two valid prod environments with two different sets of gems
<sylario>
well, you can present RVB and RBenv to your devops
<sylario>
-RVB +RVM
<sylario>
or dockers
ur5us has quit [Remote host closed the connection]
<matthewd>
conall: Again, this is what the lockfile is for
solocshaw has quit [Remote host closed the connection]
solocshaw has joined #ruby
<sylario>
conall :that's the kind of discussion you are supposed to have when you choose a language and it's tools.
<conall>
sylario, mattewd: I agree with this solution. I will install two rvm environments and just manually install the specific versions of gems on each rvm env
<matthewd>
That's absolutely not what I'm suggesting
patrontechnosoft has joined #ruby
<conall>
matthewd: I believe it is what sylario was suggesting. Could yo clarify what you are suggesting? Sorry for the confusion
<sylario>
I'm suggesting you should have a meeting with whoever is in charge of prod
<matthewd>
conall: The Gemfile.lock states the versions of gems to be used. If you have two environments you need to emulate, then you use two Gemfile.lock files.
patrontechnosoft has quit [Read error: No route to host]
montanonic has joined #ruby
patrontechnosoft has joined #ruby
<sylario>
and also with the people already deploying ruby on the prod
ascarter has joined #ruby
<conall>
Ok, so two different Gemfile.lock files, one for each prod environment?
solocshaw has quit [Client Quit]
<matthewd>
conall: Right
<conall>
matthewd: Ok, that should be doable. What is a valid situation whereby two different rvm environments would be a good solution? When two different version if ruby are in play? Just wondering...
mim1k has quit [Read error: Connection reset by peer]
patronte_ has joined #ruby
patrontechnosoft has quit [Read error: Connection reset by peer]
patronte_ has quit [Remote host closed the connection]
<matthewd>
Personally I have never encountered a situation where I wanted a second RVM environment (or even one, tbh, but that's mostly just personal tooling preference)
patrontechnosoft has joined #ruby
doublemalt_ has joined #ruby
ur5us has joined #ruby
umaaji has quit [Quit: Leaving...]
ascarter has quit [Ping timeout: 255 seconds]
<matthewd>
(in post-Bundler times, that is -- it was a reasonable solution to the problem before that)
patrontechnosoft has quit [Remote host closed the connection]
<conall>
matthewd: sylario: Thanks for yer help with this
patrontechnosoft has joined #ruby
patrontechnosoft has quit [Read error: No route to host]
patrontechnosoft has joined #ruby
mitt3ns has joined #ruby
agent_white has quit [Ping timeout: 255 seconds]
Tempesta has quit [Quit: See ya!]
mim1k has joined #ruby
mooser has joined #ruby
ur5us has quit [Remote host closed the connection]
Tempesta has joined #ruby
mooser has quit [Ping timeout: 240 seconds]
ketan has quit [Remote host closed the connection]
ketan has joined #ruby
pandaant has quit [Remote host closed the connection]
nanoz] has joined #ruby
mooser has joined #ruby
ketan has quit [Ping timeout: 240 seconds]
nanoz has quit [Ping timeout: 255 seconds]
Mortomes|Work has quit [Ping timeout: 260 seconds]
montanonic has quit [Ping timeout: 260 seconds]
mooser has quit [Client Quit]
patrontechnosoft has quit [Read error: Connection reset by peer]
ketan has joined #ruby
sepp2k has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
hightower2 has joined #ruby
arup_r has joined #ruby
mim1k has quit [Ping timeout: 248 seconds]
xall has quit [Ping timeout: 255 seconds]
<arup_r>
Do we have the opposite String#empty? in Ruby? I was looking through the doc not seeing anything.. Like Rails has .present?
<manveru>
you could use ''.chars.any?
<matthewd>
arup_r: I don't think so. `str[0]` would work ¯\_(ツ)_/¯
<herwin>
!string.empty?
<arup_r>
^ this is what I am using
<manveru>
:)
<arup_r>
ok cool. :) I thought I am missing something.
kev1n has quit [Remote host closed the connection]
tacoboy has joined #ruby
soLucien has joined #ruby
cschneid has quit [Ping timeout: 246 seconds]
kryptoz has joined #ruby
Mon_Ouie has joined #ruby
cschneid has joined #ruby
__Yiota has joined #ruby
bkxd has joined #ruby
bkxd_ has joined #ruby
soLucien has quit [Ping timeout: 240 seconds]
jyaworski has joined #ruby
bkxd_ has quit [Ping timeout: 255 seconds]
bkxd has quit [Ping timeout: 255 seconds]
bkxd has joined #ruby
andikr has quit [Remote host closed the connection]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bkxd has quit [Ping timeout: 260 seconds]
xall has quit [Quit: xall]
ta_ has quit [Ping timeout: 276 seconds]
jyaworski has quit [Ping timeout: 268 seconds]
soLucien has joined #ruby
jnollette has quit [Ping timeout: 248 seconds]
brian_penguin has joined #ruby
shinnya has joined #ruby
mooser has joined #ruby
mim1k has joined #ruby
ketan has quit [Remote host closed the connection]
ketan has joined #ruby
brian_penguin has quit [Ping timeout: 260 seconds]
gimmic has left #ruby [#ruby]
vuoto has quit [Remote host closed the connection]
brian_penguin has joined #ruby
anisha has quit [Read error: Connection reset by peer]
knight33 has joined #ruby
anisha has joined #ruby
BSAlb has joined #ruby
TomyLobo2 has joined #ruby
TomyLobo has quit [Ping timeout: 276 seconds]
jyaworski has joined #ruby
BSaboia has quit [Ping timeout: 260 seconds]
ltem has joined #ruby
lissitzki has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
haylon has joined #ruby
rgiscard has joined #ruby
jyaworski has quit [Ping timeout: 240 seconds]
DLSteve_ has joined #ruby
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
brian_penguin has quit [Ping timeout: 240 seconds]
brian_penguin has joined #ruby
hs366 has quit [Quit: Leaving]
chouhoul_ has joined #ruby
antgel has quit [Ping timeout: 240 seconds]
nanoz] has quit [Quit: <3]
antgel has joined #ruby
chouhoulis has quit [Ping timeout: 258 seconds]
anisha has quit [Quit: This computer has gone to sleep]
mim1k has quit [Ping timeout: 260 seconds]
abhi56rai has joined #ruby
arup_r has quit []
abhi56rai has quit [Client Quit]
abhi56rai has joined #ruby
abhi56rai has quit [Client Quit]
jnollette has joined #ruby
Mon_Ouie has quit [Ping timeout: 260 seconds]
brian_penguin has quit [Remote host closed the connection]
jnollette has quit [Ping timeout: 260 seconds]
svara has quit [Read error: Connection reset by peer]
griffindy has joined #ruby
psychicist__ has joined #ruby
uZiel has joined #ruby
<baweaver>
@dminuoso: miss me?
chouhoul_ has quit [Remote host closed the connection]
chouhoulis has joined #ruby
<dminuoso>
baweaver: There's no baweaver_missing in my codebase _yet_
<dminuoso>
But I can change that with a single commit.
<baweaver>
Heh
<baweaver>
RE: Lonely op: Well, we got something at least.
<dminuoso>
baweaver: You know whats fun?
<baweaver>
As far as true monadic, that'd take some serious backend overhauls to make work. Moreso to make it work _well_
<dminuoso>
baweaver: Nah.
<dminuoso>
baweaver: All we need is Haskell bindings for truffle.
charliesome has joined #ruby
<dminuoso>
Then we can interop with Haskell.
<dminuoso>
Free monads.
jnollette has joined #ruby
Dimik has joined #ruby
ResidentBiscuit has joined #ruby
<baweaver>
dminuoso: we could make a tshirt out of that
DLSteve_ has quit [Quit: All rise, the honorable DLSteve has left the channel.]
<baweaver>
Ship one to Radar. He'd wear it
charliesome has quit [Client Quit]
InfinityFye has quit [Ping timeout: 240 seconds]
webopsx has joined #ruby
doublemalt_ has quit [Ping timeout: 248 seconds]
kobain has joined #ruby
<dminuoso>
baweaver: So let's play Rock Paper Scissors Lizard Spock to determine which one of us convinces chrisseaton to add truffle bindings?
theunraveler has joined #ruby
DLSteve_ has joined #ruby
<baweaver>
dminuoso: ready?
<baweaver>
apeiros: you on?
patarr has joined #ruby
lissitzki has quit [Quit: Leaving]
cam27 has joined #ruby
patarr has quit [Ping timeout: 240 seconds]
chouhoul_ has joined #ruby
aupadhye has quit [Ping timeout: 258 seconds]
doublemalt_ has joined #ruby
mooser has quit [Remote host closed the connection]
theRoUS|afk is now known as theRoUS
chouhoulis has quit [Ping timeout: 258 seconds]
oleo has joined #ruby
cyphase has joined #ruby
cyphase has quit [Max SendQ exceeded]
BlkDynmt has joined #ruby
cyphase has joined #ruby
mim1k has joined #ruby
mark_66 has left #ruby ["PART #elixir-lang :PART #crystal-lang :PONG :hobana.freenode.net"]
cyphase has quit [Max SendQ exceeded]
cyphase has joined #ruby
cyphase has quit [Max SendQ exceeded]
cyphase has joined #ruby
cyphase has quit [Max SendQ exceeded]
cyphase has joined #ruby
<Bish>
is there something like a pooled fork?
cyphase has quit [Max SendQ exceeded]
cyphase has joined #ruby
cyphase has quit [Max SendQ exceeded]
xall has joined #ruby
webopsx has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Bish>
since threading of ruby sucks ( dont tell me it doesnt ), i want to have a solution that doesnt suck
<Bish>
im writing a background worker for a projects which reacts to events on database
<elomatreb>
So a job queue?
patarr has joined #ruby
<Bish>
and some of the event handlers use heavy CPU
<Bish>
how does a queue help me when using forks?
<adam12>
Bish: Maybe the parallel gem will work for you?
* Bish
googles
<adam12>
I'd suggest the concurrent-ruby gem, but it's threads only.
<Bish>
i hate ruby threads, they really suck
<adam12>
Yeah? If you're doing IO stuff, they're mostly fine.
<Bish>
thats why i said some of the handlers use heavy cpu
<Bish>
which would result in the worker being really slow when having one of those jobs
<elomatreb>
Ruby threads are regular OS threads, they're just not running like you want them to
<Bish>
elomatreb: bs
<adam12>
I'm not sure how your monitoring database events, but maybe you could use an off the shelf async queue like Backburner or Sidekiq.
<adam12>
Likely Backburner over Sidekiq, as it has a forking model and Sidekiq I don't believe does.
<Bish>
never heard of backburner, thanks for the input
<Bish>
hope it wont burn my back
<adam12>
lol
mooser has joined #ruby
patarr has quit [Ping timeout: 255 seconds]
<Bish>
tf is beanstalk
__Yiota has joined #ruby
<adam12>
Job queue before redis was cool.
<matthewd>
I think resque is still the most popular forking job library.. maybe?
<Bish>
i try to avoid additional daemons as much as possible
<Bish>
decided to move around redis at one point of the project
mooser has quit [Remote host closed the connection]
<darix>
matthewd: sidekiq!
<adam12>
Bish: Well in that case, you could just write your own. Use the Queue class from stdlib, have a bunch of workers pre-fork, have one process listen to database events and stick them in the queue. Have your forked processes pop the queue.
<Bish>
thought about that one already
<Bish>
maybe thats clever
<Bish>
queues work between forks?
<darix>
Bish: could it be you reimplement things like sensu?:p
<adam12>
Bish: You're solving a bunch of other problems like workers dying and needing restart
belmoussaoui has joined #ruby
* Bish
does not know what sensu is
<ineb>
sensupp, monitoring framework
<adam12>
Bish: I'm not sure if that will work actually. I can't remember, but you could use IO.pipe.
<Bish>
but yes, i wrote some monitoring tool back in the days, lol
<ineb>
*sensuapp
polishdub has joined #ruby
<Bish>
it was a ruby ~100 liner, putting stuff in a table
jyaworski has joined #ruby
<Bish>
worked well
<mikecmpbll>
i wish i'd gone with a forking background job worker :( #memoryissues
<Cork>
anyone know a way around "uninitialized constant OpenSSL::Digest::DSS1" when using Net::SSH?
<mikecmpbll>
our worker gets about 3 restarts a day atm. restarts when it hits 6GB memory :D
<adam12>
I like Backburner. Sidekiq is good too, but I had issues with it missing jobs occasionally. Never could figure out if it was a Redis or Sidekiq issue.
<Cork>
i'm connecting to a server that isn't mine so i can't fix what ciphers it uses
<adam12>
Cork: Could you force a cipher you think youd' have in common with the server?
* Bish
writes his own prefork job worker
<mikecmpbll>
Bish : for sidekiq?
<Bish>
no, vanilla ruby :>
<mikecmpbll>
ah :)
<Bish>
i want to avoid things like
<Cork>
adam12: i thought the client sends a list of supported ciphers and the server responds with the one it picks
<Bish>
"i dunno where my job went, lol"
<Bish>
but i will take another look at sidekiq
<Bish>
does it has redis as dependency?
<mikecmpbll>
yeah. maintainer isn't interested in alternative stores
<adam12>
Cork: I'm not sure - but in the past, I've forced the blowfish cipher for backups, so I thought it might be possible?
<mikecmpbll>
which keeps it simple i guess.
<Bish>
why does it need a store?
<mikecmpbll>
for the scheduled jobs
<mikecmpbll>
and queues
<Cork>
hmm, will try, thx for the idea
<Bish>
is it like, the webapp puts things into that redis thing
patarr has joined #ruby
chouhoul_ has quit [Remote host closed the connection]
<Bish>
and your worker catches it from there?
* Bish
uses the queue capabilities of postgresql and listen,notify for notifying workers to wake up
<mikecmpbll>
the worker doesn't handle job serialisation/deserialisation
chouhoulis has joined #ruby
<mikecmpbll>
you wouldn't gain a lot from a bg processing library if it left all that to you
charliesome has joined #ruby
<Bish>
okay, so it will be vanilla ruby
<mikecmpbll>
:)
<adam12>
Bish: There's a library called qu ? que? that did that.
<Bish>
que?¿
ketan has quit [Remote host closed the connection]
<Papierkorb>
rapha: Not exactly, Dir.glob() takes an optional flags as second argument. Though I didn't even know until now myself, I always used `Dir[]` :)
<rapha>
Papierkorb: I like Dir[] better, but can't get it to take a block for looping through the results. Is that what you mean by does not take optional flags?
<dminuoso>
elomatreb: Are you telling me you dont pursue the poetic perfection of pure functional programming?
* rapha
wonders why dminuoso and elomatreb have not long abandoned #ruby for #haskell
Joufflu has joined #ruby
workmad3 has quit [Ping timeout: 260 seconds]
<dminuoso>
rapha: What is that code supposed to do?
<dminuoso>
I mean.. I see '*'+'*' in that code
<elomatreb>
rapha: I'm not sure, but my guess is you're forgetting to insert separators between your path components?
<dminuoso>
So I expect a big brainfart.
cagomez has quit []
latemus has quit [Ping timeout: 246 seconds]
<rapha>
dminuoso: It takes a path and extracts some parts of it into the variables in line 6.
<dminuoso>
regex it.
cagomez has joined #ruby
cseder has joined #ruby
<rapha>
ROFLMAOLOL
<rapha>
Why is my brain always such a tomatoe?
latemus has joined #ruby
tolerablyjake has joined #ruby
<rapha>
dminuoso: '*'+'*' is a case of 'self-documenting code, rapha-style', though
truenito has joined #ruby
<rapha>
not using a regex is a big-o brainfart.
danguita has quit [Quit: WeeChat 1.9]
<elomatreb>
A Big O brainfart? Is that better or worse than O(n²)? :P
<cseder>
Hi! I have the "Pickaxe" book for Ruby 1.9 in paper form. They've released a 4th edition that covers 1.9 and 2.0. Are there so many differences between 1.9 and 2.0 that it warrants purchasing the 4th edition?
<dminuoso>
cseder: Ditch it. Get `The Well-Grounded Rubyist`
<havenwood>
cseder: Now that Ruby 2.4 is out even 2.0 is fairly dated.
<dminuoso>
The pickaxe is how you learned Ruby 10 years ago.
<dminuoso>
Now we have books.
<ule>
Hey guys.. a = %w(foo bar) b = {:foo => 1, :bar => 2, :pub => 3} How would you remove :foo and :bar from "b" ? Any magic thing to pass a .reject over all elements in "b" based off "a" ?
<havenwood>
cseder: The Second Edition of the Well-Grounded Rubyist reflects modern Ruby pretty well.
<cseder>
havenwood dminuoso ok, thanks. I'll order that then. I'm going to jail for a couple of months, so I need something to study! :(
<cseder>
damned alcohol
<havenwood>
It's from 2014, but at least it's solidly Ruby 2.
danguita has joined #ruby
<ule>
apeiros: ping
hogetaro has quit [Ping timeout: 276 seconds]
<havenwood>
cseder: Get Ruby Under a Microscope too!
<dminuoso>
^^^
hogetaro has joined #ruby
<dminuoso>
Best Ruby book
<cseder>
havenwood have it!
<dminuoso>
Despite being old
<dminuoso>
And somewhat incorrect in lots of places
<dminuoso>
But still amazing.
<rapha>
elomatreb: Oh now I see why you thought that I was missing separators. Config.data is not a String though, but a Pathname.
Cohedrin_ has quit [Ping timeout: 240 seconds]
danguita has quit [Client Quit]
<rapha>
German Amazon thinks there's two editions of The Well-Grounded Rubyist from 1600 and from 1707, that is, before the one from 2009 and 2014.
hutch34 has joined #ruby
danguita has joined #ruby
graft has quit [Ping timeout: 240 seconds]
graft has joined #ruby
danguita has quit [Client Quit]
Bock has quit [Ping timeout: 240 seconds]
<cseder>
rapha better get the 1707 version!
<cseder>
co authored by ada lovelace
ta_ has joined #ruby
<apeiros>
ule: pong
freeman42 has quit [Quit: Leaving]
<ule>
apeiros: a = %w(foo bar) b = {:foo => 1, :bar => 2, :pub => 3} How would you remove :foo and :bar from "b" ? Any magic thing to pass a .reject over all elements in "b" based off "a" ?
danguita has joined #ruby
cadillac_ has quit [Ping timeout: 255 seconds]
<dminuoso>
apeiros: Echo.
<apeiros>
ule: you can just ask such things the whole channel. I'm not the only competent rubyist around ;-)
<dminuoso>
ule: Im still thinking.
<elomatreb>
ule: Do you want to modify b or get a new object?
<dminuoso>
elomatreb: WHAT?
<dminuoso>
elomatreb: How dare you?
<dminuoso>
:(
<ule>
I'm doing this now: b.reject { |z| z == "foo" || z == "bar" }
<ule>
but it's kind of ugly
<apeiros>
if you know that a.size is usually < b.size, I'd go with a.each do |k| b.delete(k); end
<dminuoso>
apeiros: Thats not elegant.
elsevero has joined #ruby
<apeiros>
it's effective. and I'm unaware of some vanilla ruby elegance for this
perniciouscaffei has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<apeiros>
with activesupport I'd do b.except(*a.map(&:to_sym))
<elomatreb>
dminuoso: Sorry, and the motivation was wrong as well (I thought Hash#delete took a list of keys)
_DanN_ has quit [Ping timeout: 255 seconds]
<apeiros>
(only with ruby 2.2+, though)
<dminuoso>
elomatreb: Was my first thought too.
<dminuoso>
elomatreb: Was going for hash.dup.delete(*keys) :P
anisha has quit [Quit: This computer has gone to sleep]
<elomatreb>
Heh, that's cheating
<ule>
you guys are awesome
<dminuoso>
Im thinking this should be a thing.
<dminuoso>
Honestly.
Cohedrin_ has joined #ruby
<apeiros>
it'd be nice, yes. it's not uncommon to delete a list of keys.
BSAlb has quit [Read error: Connection reset by peer]
<apeiros>
you forgot to account for symbol mapping, though
<apeiros>
ule: of course, if you can, do a = %i[foo bar], no symbol mapping needed with that
<elomatreb>
Or even something like dminuosos suggestion with the dup, Hash#without(*keys) or something like that
<dminuoso>
elomatreb: I don't think something like that would pass by nobu.
webopsx has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<dminuoso>
It'd have to be a destructive method
<ule>
awesome.. thank you very much guys
<elomatreb>
I'm not familiar enough with Ruby internals processess to understand that :(
<ule>
:*
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
elomatreb: It'd be too similar to delete. It'd be easy to convince them to allow delete allow multiple arguments.
skweek has quit [Ping timeout: 268 seconds]
<dminuoso>
But adding new methods is not often done.
<elomatreb>
True, I was just thinking that there really is no non-destructive method to do that (besides effectively building your own with reject)
muelleme_ has joined #ruby
polysics has joined #ruby
<dminuoso>
hash.reject { |k, _| keys.include? k }
_DanN_ has joined #ruby
<dminuoso>
apeiros: ^- if anything my argument would be that this could be potentially expensive due to a large amount of methods being dispatched.
<dminuoso>
(That and all the overhead for pushing and popping control frames for the block and #include?
<elomatreb>
Having your keys in a Set would of course be helpful
danguita has quit [Quit: WeeChat 1.9]
<dminuoso>
elomatreb: Well, if its baked directly into Hash#delete (and Array#delete) it would happen directly inside a c func, bypassing ruby entirely.
xall has quit [Ping timeout: 240 seconds]
<ule>
dminuoso: that works as well
<dminuoso>
elomatreb: But actually you are right. Might as well modify reject to also allow arguments.
<dminuoso>
i.e. hash.reject(:useless)
<ule>
apeiros: good point.. I did %i[..
<dminuoso>
(And then give it the same treatment)
<elomatreb>
Oh, I could see an argument against that, since you'd be adding magic behavior to an Enumerable method
<dminuoso>
elomatreb: not enumerable.
<dminuoso>
elomatreb: Those are methods on Array and Hash.
webopsx has joined #ruby
__Yiota has joined #ruby
mooser has joined #ruby
<elomatreb>
reject isn't Enumerable?
<rapha>
cseder: Ada and Ruby in perfect union, that would be quite the language :)
<dminuoso>
elomatreb: Mmm they are.
<dminuoso>
elomatreb: But for optimization purposes they are defined on Hash and Array
<dminuoso>
but point taken
<dminuoso>
shouldnt modify those special cases and stray away from the Enumerable interface
<havenwood>
Ada isn't running on Truffle and Graal... yet! ;-P
<apeiros>
ule: it's not .each which is faster, it's the construct
perniciouscaffei has joined #ruby
<apeiros>
even more so if keys is an array (hence elomatreb's comment re Set)
<dminuoso>
apeiros: Which construct?
<havenwood>
Call Java, JS or R functions directly from Ruby ^
preyalone has quit [Quit: Connection closed for inactivity]
<apeiros>
dminuoso: the each+delete construct vs. the reject+include construct.
<elomatreb>
ule: include? in an Array has to potentially iterate through all elements in it to see if it includes something
<dminuoso>
apeiros: Why?
<dminuoso>
apeiros: reject is just dup.delete_if
Cohedrin_ has joined #ruby
bkxd has joined #ruby
bkxd_ has joined #ruby
<dminuoso>
apeiros: Due to how caches work I expect them to perform fairly similarly.
nobitanobi has joined #ruby
<dminuoso>
(for reasonably sized hashes)
<dminuoso>
elomatreb: Whether a set would be preferrablye really depends on the size.
<dminuoso>
If its just a handful the array is going to be much faster.
<dminuoso>
elomatreb: Another big problem is that Set introduces an artificial layer causing twice as many methods for a single lookup
<apeiros>
assuming keys is an array, it'll be O(n*m) vs. O(m), that's the one we don't need to discuss
<dminuoso>
Adding the hashing done by the underlying Hash
<dminuoso>
apeiros: Bull.
<apeiros>
if you call science bull, fine
<dminuoso>
apeiros: Unless you get into astronomically sized arrays, the massive overhead of twice the method dispatch and the hashing is greatly offset by a linear search of hot memory.
<apeiros>
assuming keys is a set, it's an argument of ruby implementation details + relative sizes
graft has quit [Ping timeout: 255 seconds]
<dminuoso>
apeiros: Okay lets turn discussion into research.
<apeiros>
I'd pose that the hash will usually be larger than the array, so you'll iterate almost certainly a larger dataset than necessary
<elomatreb>
(Crowd starts to chant: Benchmarks! Benchmarks!)
<apeiros>
the ruby implementation details would be how reject will iirc construct an array for every yield
graft has joined #ruby
graft has joined #ruby
graft has quit [Changing host]
<dminuoso>
apeiros: Alright. Let's assume a hash of say 100_000 pairs?
<dminuoso>
And an array of 100 keys?
nobitanobi has quit [Ping timeout: 260 seconds]
<apeiros>
I'm afk now, but do tell me the result of your research, I'll read up on it
<dminuoso>
apeiros: Alright.
danguita has joined #ruby
bkxd_ has quit [Ping timeout: 260 seconds]
bkxd has quit [Ping timeout: 260 seconds]
<ule>
elomatreb: lol
danguita has quit [Client Quit]
<elomatreb>
I'm picturing a crowd in a not very well lit parking garage standing in a circle around two persons on laptop
truenito has quit [Read error: Connection reset by peer]
t-recx has joined #ruby
mooser has quit [Remote host closed the connection]
Cohedrin_ has quit [Read error: Connection reset by peer]
ltem has quit [Quit: Leaving]
Cohedri__ has joined #ruby
danguita has joined #ruby
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
danguita has quit [Client Quit]
<dminuoso>
Oh.
<dminuoso>
apeiros: Heh.
jenrzzz has joined #ruby
DTZUZU has quit [Quit: WeeChat 1.5]
<dminuoso>
Okay. So merely wrt to set vs array, for small ones (10) they perform equally well.
<dminuoso>
After that set starts to take off.
danguita has joined #ruby
<dminuoso>
And I harshly ignored your arr.each { |e| hash.delete(e) } because Im an idiot.
<dminuoso>
And I also understand why you thought it was a joke.
<dminuoso>
(The code repetition is real because it was faster to just copy and modify with vim than to provide a sensible abstraction)
truenito has quit [Ping timeout: 240 seconds]
andrzejku has joined #ruby
zapata has quit [Quit: WeeChat 1.9]
<dminuoso>
And that hash is probably best constructed as hash = Array.new(100_000) { [SecureRandom.uuid.to_sym, SecureRandom.uuid] }.to_h
DTZUZU has joined #ruby
Cohedri__ has quit [Ping timeout: 246 seconds]
troys is now known as troys_
nobitanobi has joined #ruby
GodFather_ has joined #ruby
Murda_ has joined #ruby
Murda_ has quit [Client Quit]
jenrzzz has quit [Ping timeout: 268 seconds]
<dminuoso>
Updated for maximum bikeshedding.
shinnya has quit [Ping timeout: 248 seconds]
Murda has quit [Ping timeout: 240 seconds]
Cohedrin_ has joined #ruby
psychicist__ has quit [Ping timeout: 268 seconds]
cagomez has joined #ruby
yarou_ has quit [Quit: This computer has gone to sleep]
InfinityFye has quit [Ping timeout: 255 seconds]
cagomez has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
Joufflu has quit [Ping timeout: 268 seconds]
aswen has joined #ruby
yarou_ has joined #ruby
Cohedrin_ has quit [Read error: Connection reset by peer]
ketan has joined #ruby
Ishido has quit [Ping timeout: 240 seconds]
Cohedri__ has joined #ruby
superflit has joined #ruby
benjen has quit [Ping timeout: 240 seconds]
mooser has joined #ruby
quuxman has joined #ruby
ianfleeton has joined #ruby
ketan has quit [Ping timeout: 258 seconds]
benjen has joined #ruby
meshsmith has joined #ruby
meshsmith has joined #ruby
meshsmith has quit [Changing host]
troys_ is now known as troys
<quuxman>
Where does Sequel.migration come from? It is undefined in pry after `require 'sequel'` but exists when I run a program from same environment that uses it
Cohedri__ has quit [Read error: Connection reset by peer]
<apeiros>
dminuoso: to be fair, reject+set.include becomes faster around keys being 1/3rd the size of the hash. that actually surprises me a bit. I did think it was possible but I didn't expect the threshold to be so low.
<cseder>
Is Test::Unit widely used and worth learning, or do most people use RSpec for both Ruby and Rails testing?
<quuxman>
cseder: I've only seen rspec but my experience is extremely limited
<apeiros>
i.e. hash.size = 1000, keys.size = 500, reject+set is faster than each+delete by almost 2x.
danguita has quit [Quit: WeeChat 1.9]
<apeiros>
cseder: test unit is about the second largest, and there's a lot of people who dislike rspec (like me)
<apeiros>
quuxman: run binding.pry in a program where you have it, then do `$ Sequel.migration`
<cseder>
apeiros why don't you like it?
<apeiros>
cseder: I've to learn a language on top of ruby for no sensible gain
Ishido has joined #ruby
<cseder>
apeiros I see
mtkd has quit [Ping timeout: 240 seconds]
<apeiros>
additionally I've got to learn its quirks and semantical specialities
<cseder>
apeiros and test::unit is better in that way?
Cohedrin_ has joined #ruby
<apeiros>
IMO yes. it's pretty plain ruby.
<quuxman>
I agree that rspec is not at all transparent for someone starting out with Ruby
<cseder>
apeiros is it the same as the one included by default in rails?
<apeiros>
"it"?
<apeiros>
test unit comes with ruby itself, not with rails
<apeiros>
if you were referring to that
<cseder>
apeiros I meant, when you start a new rails project it generates test stubs, is this using test::unit?
<adam12>
quuxman: Sequel uses a plugin-style structure, which means just requiring sequel might not give you the methods you want.
mtkd has joined #ruby
<apeiros>
cseder: oh, I don't actually know. been a while since I created a new rails project where I wanted to write tests for it.
<cseder>
the generators in rails
<quuxman>
adam12: presumably I have to require additional packages?
<adam12>
quuxman: No, Sequel does that for you when you call it's `extension` method.
jhooker has joined #ruby
<adam12>
quuxman: Anyways, I think I am wrong, kinda. The `Sequel.migration` method likely only exists when being called from the `sequel` binary, or Sequel::Migrator.apply method.
wilbert has quit [Quit: wilbert]
<quuxman>
adam12: well that's weird. How do I use it from pry to debug things?
wilbert has joined #ruby
<adam12>
quuxman: What are you trying to debug?
<cseder>
apeiros rails generators create minitest stubs from ActiveSupport, so guess it's not the same animal
ascarter has joined #ruby
<apeiros>
minitest is the replacement of test-unit and that'd actually be what ships with ruby
<quuxman>
adam12: create_table() call that produces the wrong SQL for the particular DB I'm using
<apeiros>
but iirc rails extends minitest a great deal
<adam12>
quuxman: Interesting. I'd try to use the `sequel` binary, with the `-m <migrations path` option, a `-r pry` option if you're using pry, and then setup a binding.pry breakpoint in the migration file.
<quuxman>
adam12: all I really need is a way to see the SQL string generated by a given create_table() call
<adam12>
quuxman: Oh.
<adam12>
quuxman: If you have a DB instance, you can use DB.create_table
cam27 has joined #ruby
<quuxman>
adam12: like with sqlalchemy: str(model.create(...))
<adam12>
I'm not sure how to get the SQL from that as a string, but you can add a logger to DB and log it to $stdout
<adam12>
quuxman: If you join #sequel, jeremyevans is super responsive and might have better suggestions.
<ruby[bot]>
superflit: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
alex`` has quit [Quit: WeeChat 1.9]
elsevero has quit [Quit: elsevero]
ascarter has quit [Ping timeout: 260 seconds]
BTRE has quit [Quit: Leaving]
<superflit>
(impressive bot)
BTRE has joined #ruby
InfinityFye has joined #ruby
jenrzzz has quit [Ping timeout: 258 seconds]
mooser has quit [Remote host closed the connection]
Joufflu has joined #ruby
dionysus69 has quit [Remote host closed the connection]
polysics has quit [Remote host closed the connection]
polysics has joined #ruby
<cseder>
Test::Unit was the built in Ruby testing library but is considered dead (development has ceased). It has been superceeded by Minitest. according to a so post
Cohedrin_ has quit [Read error: Connection reset by peer]
jhooker has quit [Remote host closed the connection]
jhooker has joined #ruby
Cohedrin_ has joined #ruby
tacoboy has quit [Remote host closed the connection]
nobitanobi has quit [Remote host closed the connection]
<cseder>
So if minitest is pure ruby and it is default with rails generators, I'm sold on minitest
jhooker has quit [Client Quit]
jhooker has joined #ruby
<elomatreb>
RSpec (the main alternative) is also pure Ruby, it's just a different design
gigetoo has quit [Ping timeout: 260 seconds]
Coldblackice has joined #ruby
Coldblackice has quit [Client Quit]
<elomatreb>
And you can tell Rails to generate multiple types of specs, I think it'll even remember the choice
gigetoo has joined #ruby
tacoboy has joined #ruby
[Butch] has quit [Quit: I'm out . . .]
ltem has joined #ruby
cagomez has joined #ruby
polysics_ has joined #ruby
mooser has joined #ruby
polysics has quit [Ping timeout: 260 seconds]
Cohedrin_ has quit [Read error: Connection reset by peer]
perniciouscaffei has quit [Ping timeout: 260 seconds]
zapata has joined #ruby
<zenspider>
elomatreb: I'd argue that it is less pure ruby in that rspec reinvents much of ruby for the sake of doing so... slows it way down. uses a ton more memory. just not worth it in my very biased opinion
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<zenspider>
where minitest just uses classes and just uses methods... nothing special. just ruby.
<elomatreb>
I'm no less biased, the first Rails project I worked on used RSpec and it stuck
bkxd has joined #ruby
bkxd_ has joined #ruby
<elomatreb>
And I haven't had speed issues with it, but I haven't work on truly large projects
<zenspider>
if you haven't measured, you don't know if you had speed issues or not.
<zenspider>
half a second adds up fast if you're really doing test driven dev
<elomatreb>
I meant something like "it was never slow enough to actively notice or annoy me", but yeah
Uranio has joined #ruby
ianfleeton has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bkxd_ has quit [Ping timeout: 248 seconds]
bkxd has quit [Ping timeout: 248 seconds]
Uranio has left #ruby [#ruby]
bkxd has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nobitanobi has joined #ruby
Fysicus has joined #ruby
sepp2k has quit [Quit: Leaving.]
bkxd has quit [Ping timeout: 248 seconds]
<cseder>
If I want to start a freelance business using RoR as the main technology, what are the options for finding hosting providers that has RoR hosting options? Is it best to choose something like Heroku PaaS and deliver on that platform, or does it exist less complex alternatives for just plain webhosting for RoR?
<Papierkorb>
cseder: A fully managed hosting solution, like Heroku, probably suits you best. It may be more expensive than other solutions, however, they maintain their servers for you, which is a thing you NEED to be knowledgable about.
workmad3 has joined #ruby
<cseder>
Papierkorb yeah, I guess... It would probably be the best alternative for other environments as well, not just RoR. I've gone all in on learning Ruby and Rails, even though as I plan on doing freelance work, I see that the demand for PHP is much larger on sites like freelancer.com, but I like Ruby better than PHP and even though I've worked as a developer using C# for desktop applications I'm not tempted to go the Asp.net route.
FysiWRK has joined #ruby
ianfleeton has joined #ruby
Fysicus has quit [Ping timeout: 260 seconds]
Dimik has quit [Ping timeout: 248 seconds]
nadir has quit [Quit: Connection closed for inactivity]
carterparks has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz has quit [Ping timeout: 276 seconds]
carterparks has left #ruby ["WeeChat 1.6"]
polysics_ has quit [Remote host closed the connection]
ldnunes has quit [Quit: Leaving]
nobitanobi has quit [Remote host closed the connection]
troys is now known as troys_
wilbert has quit [Ping timeout: 248 seconds]
oncall-pokemon has quit [Quit: Connection closed for inactivity]
tolvstaa has quit [Quit: WeeChat 1.0.1]
mim1k has joined #ruby
workmad3 has quit [Ping timeout: 248 seconds]
mim1k has quit [Ping timeout: 248 seconds]
romankapitonov has joined #ruby
patarr_ has joined #ruby
troys_ is now known as troys
biberu has quit []
patarr has quit [Ping timeout: 260 seconds]
superflit has quit [Ping timeout: 246 seconds]
nobitanobi has joined #ruby
mooser has quit [Remote host closed the connection]
raspado has joined #ruby
Cohedrin_ has quit [Read error: Connection reset by peer]
<zenspider>
ffs... I'm running inside of docker on an alpine ruby box... it uses busybox for userspace so `less` isn't standard. pry is FREAKING out because it is trying to page everything :(
ur5us has joined #ruby
<eam>
PAGER=cat
__Yiota has joined #ruby
mooser has joined #ruby
<zenspider>
a bit late... I don't have much control over ENV at this point
<zenspider>
and of course help wants to use the pager :P
<eam>
aha
<eam>
can you set ENV?
<Zarthus>
You're running pry but have no control over the environment?
<darix>
zenspider: Pry.config.parge='cat'
milardovich has joined #ruby
<darix>
zenspider: Pry.config.pager='cat'
<Zarthus>
I'd imagine PAGER=cat pry should work, or just set the env within pry :P
<darix>
err
<darix>
sorry
<Zarthus>
although darix's solution seems saner
<darix>
Pry.config.pager = false
<darix>
that
ketan has joined #ruby
<darix>
zenspider: ^
Cohedrin_ has joined #ruby
<zenspider>
parge. :P
<zenspider>
I ran pry locally so I could read the help and found `change-inspector simple`
Bilge- is now known as Bilge
<darix>
zenspider: after over 12h working typos are allowed
<havenwood>
that's just me being silly - removing the Pry "cat" command so I can use `cat` as a local variable
<Zarthus>
I'll just resort to pussy in the meantime
<havenwood>
but you can remove any Pry command that way
<havenwood>
Zarthus: Please none of that.
ketan has quit [Ping timeout: 248 seconds]
<zenspider>
why even say please?
enterprisey_ has quit [Remote host closed the connection]
eckhardt has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rustbest has joined #ruby
splitshot has quit [Quit: Leaving]
<zenspider>
the fact that puts will chomp the string will never ever stop vexing me
<zenspider>
drives me nuts
__Yiota has joined #ruby
ltem has quit [Quit: Leaving]
<SeepingN>
is that new?
nobitanobi has quit [Remote host closed the connection]
Cohedrin_ has quit [Read error: Connection reset by peer]
cam27 has quit [Quit: cam27]
<havenwood>
It is a strange thing that `puts "foo"` and `puts "foo\n"` both print the same thing but the former may not print them together in a multithreaded situation.
<rustbest>
https://pastebin.com/0YbFNcQQ guys is there any way to create a "constant"-like thing pointing to "Example::Test"? So I wont need to call this big expression.
<ruby[bot]>
havenwood: # => unknown keyword: capacity (ArgumentError) ...check link for more (https://eval.in/828228)
<zenspider>
rustbest: doesn't need to be X either... can be x
<zenspider>
(constant vs local)
<havenwood>
#=> 10000000000041
Ishido has quit [Read error: Connection reset by peer]
<havenwood>
Ah, forgot the bot was 2.3.
<clemens3>
zenspider: isn't puts doing the opposite of chomp?
<zenspider>
it does both
<zenspider>
puts "x" outputs the same as puts "x\n"
<zenspider>
so if you want an extra newline, you must double it up
<clemens3>
but chomp removes the n
<zenspider>
yup
<clemens3>
puts adds one if one is missing
<zenspider>
that's... not how I see it
<zenspider>
puts is print w/ a newline... unless it has a newline
<clemens3>
puts makes sure there is newline
<clemens3>
chomp removes newline
<zenspider>
are you a broken record?
<clemens3>
seems pretty opposite to me
<havenwood>
clemens3: Note how many newlines this prints: puts "one\n"
<zenspider>
clemens3: you seem pretty opposite to me
<clemens3>
prints one
<havenwood>
clemens3: How many newlines do you expect to be printed, one right?: ""
ecuanaso has joined #ruby
<clemens3>
yes
<havenwood>
clemens3: How many now?: "\n"
<clemens3>
"x".chomp
<havenwood>
Still one?
<clemens3>
how many newlines removed?
<havenwood>
clemens3: #=> "x"
<havenwood>
clemens3: None.
<clemens3>
"x\n".chomp
Joufflu has quit [Ping timeout: 240 seconds]
romankapitonov has quit [Ping timeout: 240 seconds]
<clemens3>
1 removed
<havenwood>
clemens3: Just to clarify, you get that `puts "\n"` and `puts ""` both print one line, yeah?
<clemens3>
yes, so zero or 1 newline are added?
marr has quit [Ping timeout: 276 seconds]
DLSteve_ has quit [Quit: All rise, the honorable DLSteve has left the channel.]
<rustbest>
https://0x0.st/06O.png since I'm expecting a lot of messages per minute, the class model isn't recommended right? I mean it will generate a new instance every second?
<zenspider>
rustbest: a png?? really?
romankapitonov has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ski7777 has quit [Ping timeout: 240 seconds]
<havenwood>
clemens3: I do think of it as separate newline added, so yeah, I see your point after rereading.
<zenspider>
rustbest: I don't understand your question wrt your "code"
<havenwood>
(Since the separate newline is indeed added, and can happen slightly later than the String being printed.)
<rustbest>
gist editor is shit, it's breaking the indentation
<rustbest>
wait a sec
nemesit|znc has quit [Ping timeout: 255 seconds]
<zenspider>
no... it's fine
<Radar>
^
Cohedrin_ has quit [Ping timeout: 240 seconds]
<Radar>
Underscore in a class? *tsk*
<zenspider>
rust style? *shrug*
duderonomy has quit [Ping timeout: 258 seconds]
aviraldg has quit [Changing host]
aviraldg has joined #ruby
aviraldg has joined #ruby
jnollette has quit [Ping timeout: 260 seconds]
<Radar>
rustbest: it has been longer than a second
<Radar>
" the class model isn't recommended right?" what made you think this?
<Radar>
And what is a Cygnus
<clemens3>
havenwood: didn't know about the timing issue.. for me the name is indeed wired.. I think print indeed was just fine.. but got used to puts
webopsx has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nofxxx has quit [Ping timeout: 240 seconds]
nofxxx has joined #ruby
<rustbest>
it's generating a new instance of log every second, even though it's the same file
Murda_ has joined #ruby
<zenspider>
rustbest: then don't do that?
<Radar>
rustbest: Perhaps put line 1 outside of the loop so that it only creates one?
<havenwood>
clemens3: You see the newline being separate often in threaded code. Two implicit newlines will stack, then the string output concatenated on one line. Explicit newline happen at the same time.
Murda_ is now known as Murda
Cohedrin_ has joined #ruby
<zenspider>
log objects are generally created and kept around
<rustbest>
I can't access the variables outside tho, it's a event
<zenspider>
yes you (probably) can
<zenspider>
actually definitely... depending on how you go about it.
ski7777 has joined #ruby
<zenspider>
but you're not providing enough code for us to actually advise
<clemens3>
havenwood: yeah, i used to have lots of flush statements even in single threaded code for debug purposes, because can't always trust if messages didn't come or delayed in some buffer
<zenspider>
that's what stderr is for
<clemens3>
well, that is the other point making sense of which err messages came with which program output..
<havenwood>
warn 'danger, will robinson'
<clemens3>
so err goes to out for me often..
<clemens3>
but i am not doing multi threading normally, so no biggy
<havenwood>
Goroutine-like primatives in Ruby? Queues as channels? Whee!
blackwind_123 has joined #ruby
ski7777 has quit [Ping timeout: 260 seconds]
<quuxman>
OK so I forked a gem, now I want to develop it in the context of a project I'm working on. How do I install it into my project?
<havenwood>
Guilds along with lighter weight, auto-scheduled green thread primitives is interesting.
romankapitonov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
quuxman: You can specify your repo and the exact commit in your Gemfile.
<quuxman>
havenwood: bun then it ends up in some archive in ~/.bundle instead of somewhere I can actually edit the code
<zenspider>
quuxman: ^^ assuming gemfile. Or you can use `ruby -Ipath-to-lib`
jnollette has joined #ruby
<zenspider>
I think you can also do file:// paths in the gemfile... not sure. By that time I usually give up on bundler
<quuxman>
I guess I could just `cp -r ~/forked-lib/lib/* ~/current-project/lib`?
<zenspider>
that's really not a good idea
<havenwood>
quuxman: Why are you doing this? What's it for?
<havenwood>
quuxman: You can edit the gem wherever it is. Why are you forking it?
<zenspider>
You can put `$: << File.expand_path("~/forked-lib/lib")` before you require it to emulate the ruby -I
webopsx has joined #ruby
<quuxman>
sounds like the best option is to simply put "file://$HOME/forked-lib" in the Gemfile
milardovich has joined #ruby
xco has joined #ruby
<clemens3>
havenwood: reading.. but luckily I don't do much parallel programming.. once tried again some gui programming with jruby and silly me wanted to do coverage testing... args
weaksauce has joined #ruby
gigetoo has quit [Ping timeout: 276 seconds]
mokiwis has joined #ruby
<xco>
i feel this might be bad but i don’t know how to do it well
<xco>
can i do something like this
<xco>
puts “hello” unless true
<xco>
?
<xco>
good or bad?
<zenspider>
xco: it's fine
<zenspider>
what's your actual concern?
gigetoo has joined #ruby
<xco>
that there’ll be an endless loop
<zenspider>
why?
<xco>
unless true means if true is false
<xco>
which will never happen
milardovich has quit [Ping timeout: 260 seconds]
<xco>
so it’ll keep going and i thought it’s bad
<zenspider>
so never happening means it'll loop forever?
<zenspider>
I thought never happening means it'll loop never
<zenspider>
did you try it?
<zenspider>
fire up irb and type it in
charliesome has joined #ruby
<xco>
:o
<xco>
aaaaa :D
<xco>
silly me
ski7777 has joined #ruby
duderonomy has joined #ruby
chmuri has quit [Ping timeout: 255 seconds]
PaulCapestany has quit [Quit: .]
ascarter has joined #ruby
gnufied has quit [Quit: Leaving]
mokiwis has quit [Ping timeout: 240 seconds]
webopsx has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ascarter has quit [Ping timeout: 260 seconds]
TomyLobo2 has quit [Ping timeout: 255 seconds]
mokiwis has joined #ruby
yarou_ has quit [Quit: This computer has gone to sleep]