havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
chris____ has quit [Ping timeout: 264 seconds]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gell5 has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jetchisel has joined #ruby
gell5 has quit [Ping timeout: 260 seconds]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
nychtel has joined #ruby
poro has joined #ruby
goepsilongo has joined #ruby
poro has quit [Quit: Leaving]
lightstalker has quit [Ping timeout: 260 seconds]
quazimodo has joined #ruby
lightstalker has joined #ruby
dualfade has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
chris____ has joined #ruby
Comstock has joined #ruby
ur5us has joined #ruby
ChmEarl has quit [Quit: Leaving]
plutes has quit [Ping timeout: 272 seconds]
jetchisel has quit [Ping timeout: 264 seconds]
gix has quit [Ping timeout: 246 seconds]
<dualfade> anyone using vim as a ruby ide ?
<apotheon> I use Vim.
<apotheon> . . . along with irb+interactive_ruby.
<apotheon> It's kind of an inside-out IDE that way.
<dualfade> huh I see. have you ever tried spacevim or anythng like that by chance ?
<apotheon> nope
<dualfade> ive been using it for quit sometime in python but autocompletion and friends are not working with ruby. Kinda odd.
<dualfade> was looking for alternatives I guess.
<apotheon> I tend to keep my Vim setup pretty simple.
<dualfade> gotcha. much apprecoates. thank you for replying. New to ruby... JUst starting with it.
nicholaslyang has joined #ruby
<apotheon> My .vimrc is almost a hundred lines long, but if you cut out comments, blank lines, and "autocmd BufEnter" stuff, it's about a third that many.
<apotheon> (where the BufEnter stuff is all crap like language-specific indentation and syntax highlighting management)
<apotheon> I don't use a single plugin.
<dualfade> thats even better ;)
cfjk has quit [Quit: The Lounge - https://thelounge.chat]
<apotheon> I very much like both vi stuff and Ruby.
cfjk has joined #ruby
<apotheon> I use vi keybindings in irb, too.
<dualfade> nice. Im hoping I like it and all goes well. Python is pissing me off to no extent hahah
<apotheon> har
<apotheon> I'm not a big fan of Python.
<dualfade> the modules are something to be told hah
<dualfade> I just bought a bunch of book and gonna try to start the migration. hoping for goodness. hah
<dualfade> is there a site you recommend for getting started ? like if you know perl pretty well and decent with python ?
<apotheon> hrm
<apotheon> I don't, really.
<dualfade> I come from perl land ( 20 years ) dont laugh haha
<dualfade> ok.
<apotheon> If you want to learn Rails, guides.rubyonrails.org might get you up and running quickly. For Ruby itself, I just have recommendations for books.
<apotheon> I used to really be into Perl, until about fifteen years ago. I suspect a tutorial or two that I wrote are still in the semi-official lineup of tutorials on PerlMonks.
<dualfade> killer. used that site many many times.
chris____ has quit [Remote host closed the connection]
goepsilongo has quit [Quit: Textual IRC Client: www.textualapp.com]
<dualfade> Well much appreciated. Im gonna try to get this thing started somewhat for tonight. Thanks again
<apotheon> For books, I think a great starting Ruby book-path is something like Eloquent Ruby -> POODR -> Sinatra Up And Running -> Understanding Computation (the second, third, and fourth can be moved around in order according to your preferences).
<apotheon> For Rails, you could skip Sinatra Up And Running and cram the Rails Guides in there early on, probably right after Eloquent Ruby.
<apotheon> There are other great books, too. Ruby is blessed with a glut of excellent books.
<dualfade> thats awesome. Thank you again
<dualfade> docs look solid too
<apotheon> welcome
<apotheon> gotta move on to meatspace
<apotheon> have fun; ta
<dualfade> ;)
chalkmonster has quit [Quit: WeeChat 2.8]
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
postmodern has joined #ruby
gell5 has joined #ruby
gell5 has quit [Ping timeout: 260 seconds]
davispuh has joined #ruby
r29v has joined #ruby
gell5 has joined #ruby
gell5 has quit [Ping timeout: 240 seconds]
gell5 has joined #ruby
woodruffw has quit [Ping timeout: 260 seconds]
woodruffw has joined #ruby
woodruffw has quit [Changing host]
woodruffw has joined #ruby
gell5 has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
donofrio has quit [Remote host closed the connection]
RiPuk has joined #ruby
gell5 has joined #ruby
kyrylo has joined #ruby
kyrylo has quit [Client Quit]
gell5 has quit [Ping timeout: 246 seconds]
r29v has quit [Quit: r29v]
r29v has joined #ruby
tabakhase__ has joined #ruby
tabakhase has quit [Ping timeout: 246 seconds]
Furai has quit [Quit: WeeChat 2.8]
r29v has quit [Ping timeout: 246 seconds]
Furai has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
chris____ has joined #ruby
Comstock has quit [Quit: Leaving]
chris____ has quit [Ping timeout: 256 seconds]
gell5 has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gell5 has quit [Ping timeout: 260 seconds]
nicholaslyang has joined #ruby
pwnd__ has quit [Ping timeout: 272 seconds]
sauvin has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
<ta> apotheon: thanks, I'll try :)
pwnd_nsfw has joined #ruby
renich has quit [Ping timeout: 264 seconds]
x0n has quit [Quit: ZNC - https://znc.in]
x0n has joined #ruby
sauvin has quit [Read error: Connection reset by peer]
cliluw has quit [Ping timeout: 256 seconds]
cliluw has joined #ruby
fercell has joined #ruby
sauvin has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
conta has joined #ruby
ur5us has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cgfbee has quit [Remote host closed the connection]
gell5 has joined #ruby
imode has quit [Ping timeout: 260 seconds]
gell5 has quit [Ping timeout: 246 seconds]
cgfbee has joined #ruby
xco has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sarna has joined #ruby
<sarna> hey, I want to be able to create my class in two ways - either directly from parameters, or by parsing some json. how would I go about implementing this? I've been thinking factories, but they seem.. clunky
plutes has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
<jhass> mh, usually something like the parsing from json way would invoke the first way, right?
<jhass> so make that your primary constructor, then just do def self.from_json(json); data = JSON.parse(json); new(...); end
nicholaslyang has joined #ruby
<sarna> oh yeah, that seems right
<sarna> thanks :)
<jhass> yw :)
<sarna> also - should the class be responsible for parsing, or should it get parsed json? in your example it does the parsing, is that conventional?
schne1der has joined #ruby
SuperLag has quit [Ping timeout: 256 seconds]
SuperLag has joined #ruby
quazimodo has quit [Ping timeout: 265 seconds]
vondruch has joined #ruby
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
cliluw has quit [Ping timeout: 264 seconds]
jinie has joined #ruby
jinie has quit [Client Quit]
jinie has joined #ruby
nychtel has quit [Ping timeout: 256 seconds]
jenrzzz_ has quit [Ping timeout: 246 seconds]
znz_jp has quit [Quit: kill -QUIT $$]
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
znz_jp has joined #ruby
infinityfye has joined #ruby
gell5 has joined #ruby
gell5 has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nicholaslyang has joined #ruby
akem__ has quit [Ping timeout: 246 seconds]
nicholaslyang has quit [Client Quit]
roadie has joined #ruby
jenrzzz has quit [Remote host closed the connection]
jenrzzz has joined #ruby
gell5 has joined #ruby
gell5 has quit [Ping timeout: 260 seconds]
dhollinger has quit [Ping timeout: 246 seconds]
dhollinger has joined #ruby
nicholaslyang has joined #ruby
postmodern has quit [Read error: Connection reset by peer]
<jhass> I can't say I've seen a clear philosophy here in the community
<jhass> do what works for you
postmodern has joined #ruby
nicholaslyang has quit [Client Quit]
Chris__ has joined #ruby
nicholaslyang has joined #ruby
Chris__ has quit [Ping timeout: 246 seconds]
nicholaslyang has quit [Client Quit]
sleetdrop has joined #ruby
cstrahan has quit [Ping timeout: 256 seconds]
reyfi9e has quit [Ping timeout: 256 seconds]
reyfi9e has joined #ruby
AndreYuhai has joined #ruby
cstrahan has joined #ruby
<AndreYuhai> Is there any way to create an array from an each loop without explicitly creating an array? https://dpaste.org/Ojyr
<AndreYuhai> I might be totally wrong but I am just asking to make sure
<AndreYuhai> Because I remember something like that but couldn't find it.
kinduff has quit [Read error: Connection reset by peer]
plutes has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
<yxhuvud> you mean like the map method?
plutes has joined #ruby
sh7d has quit [Quit: meh]
sh7d has joined #ruby
akem has joined #ruby
akem has quit [Client Quit]
akem has joined #ruby
akem has quit [Max SendQ exceeded]
doomlist3 has joined #ruby
akem has joined #ruby
quazimodo has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
sleetdrop has quit [Ping timeout: 264 seconds]
sarna has quit [Quit: Connection closed]
cranq has quit [Ping timeout: 264 seconds]
cranq has joined #ruby
sarna has joined #ruby
tabakhase__ has quit [Quit: ZNC - http://znc.in]
tabakhase has joined #ruby
<AndreYuhai> yxhuvud, Oh yea map already does what I meant haha. Thank you. :)
<AndreYuhai> I just thought I could do that with an each loop but I am probably wrong
nicholaslyang has joined #ruby
conta has quit [Quit: conta]
doomlist3 has quit [Ping timeout: 264 seconds]
nicholaslyang has quit [Client Quit]
<yxhuvud> Well, each returns an iterator and iterators also respond to map, so [1,2,3].each.map { |x| x + 1 } would also work
doomlist3 has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has quit [Ping timeout: 264 seconds]
<AndreYuhai> yxhuvud, thank you
nicholaslyang has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
nicholaslyang has quit [Client Quit]
jingjinghack has joined #ruby
lazarus1 has joined #ruby
postmodern has quit [Quit: Leaving]
<sarna> I'm trying to use Faraday and it doesn't seem to respect the params I give it.. can I somehow inspect the request before executing it?
<sarna> an url would be enough I think
<sarna> oh, #get takes a block
<sarna> well.. my params got nested >.>
<sarna> I create a connection with params and then add params when executing connection#get.. I end up with `params: {foo: "bar", params: {baz: "qux"}}`
<sarna> how would I solve this? I'm really confused :/
Secret-Fire has quit [Remote host closed the connection]
Secret-Fire has joined #ruby
<sarna> I solved it with this: `conn.get 'path' do |request| request.params['foo'] = 'bar' end`
gell5 has joined #ruby
gell5 has quit [Ping timeout: 264 seconds]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
doomlist3 has quit [Ping timeout: 260 seconds]
<jennis> Hello, I'm struggling to find an email validator/regexp that says the email "foo.@bar.com" is invalid. According to the RCF882 email validator (https://sphinx.mythic-beasts.com/~pdw/cgi-bin/emailvalidate), it should be invalid
<jennis> I've tried Devise.email_regexp , /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i (from Michael Hartl's rails tutorial), the builtin Ruby URI:MailTo:EMAIL_REGEXP and the Mail gem's Mail::Address.new('foo.@bar.com') , all of them say that this is a valid email!
Secret-Fire has quit [Read error: Connection reset by peer]
Secret-Fire has joined #ruby
nicholaslyang has joined #ruby
donofrio has joined #ruby
BTRE has quit [Quit: Leaving]
nicholaslyang has quit [Client Quit]
<jennis> Aha, valid_email2 (https://github.com/micke/valid_email2) does the trick
Secret-Fire has quit [Read error: Connection reset by peer]
Secret-Fire has joined #ruby
BTRE has joined #ruby
<al2o3-cr> jennis: use uri
<al2o3-cr> &>> URI::MailTo::EMAIL_REGEXP.match? "foo.@bar.com"
davispuh has quit [Ping timeout: 265 seconds]
<rubydoc> stderr: -e:4:in `<main>': uninitialized constant URI (NameError)... check link for more (https://carc.in/#/r/98tk)
<al2o3-cr> &>> require 'uri'; URI::MailTo::EMAIL_REGEXP.match? "foo.@bar.com"
<rubydoc> # => true (https://carc.in/#/r/98tl)
<jennis> al2o3-cr, unfortunately this returns this email address as a valid email
<jennis> which is not what I want
Secret-Fire has quit [Remote host closed the connection]
<al2o3-cr> jennis: oh, i hadn't seen you already said that. my bad :P
Secret-Fire has joined #ruby
* al2o3-cr puts his bins on.
TCZ has joined #ruby
nicholaslyang has joined #ruby
davispuh has joined #ruby
nicholaslyang has quit [Client Quit]
vondruch has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jennis> hehe no worries
drincruz has joined #ruby
drincruz has quit [Ping timeout: 256 seconds]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
conta has joined #ruby
conta1 has joined #ruby
Takumo has joined #ruby
conta has quit [Ping timeout: 264 seconds]
conta1 is now known as conta
Takumo has quit [Client Quit]
Takumo has joined #ruby
buckworst has joined #ruby
fercell has quit [Ping timeout: 246 seconds]
TCZ has quit [Quit: Leaving]
venmx has joined #ruby
nicholaslyang has joined #ruby
<sarna> does `foo(bar: baz)` == `foo({:bar => baz})`?
nicholaslyang has quit [Client Quit]
gell5 has joined #ruby
dionysus69 has joined #ruby
gell5 has quit [Ping timeout: 258 seconds]
drincruz has joined #ruby
Garb0 has joined #ruby
Garb0 has quit [Max SendQ exceeded]
Garb0 has joined #ruby
Chris__ has joined #ruby
dostoyevsky has quit [Ping timeout: 256 seconds]
<dualfade> morning. Anyone have an example of base64 decode ( uri decode ( str )) ? Im getting weired errors and just started with ruby.
<dualfade> or ref. Not finding it. probably searching wrong
<dualfade> I love ruby's split and array ref. frigging nice.
<jhass> &>> require "base64"; Base64.decode64("SGVsbG8gV29ybGQh")
<rubydoc> # => "Hello World!" (https://carc.in/#/r/98ts)
dostoyevsky has joined #ruby
<dualfade> I can do each fine by themselves but not combined
Chris__ has quit [Ping timeout: 264 seconds]
<jhass> maybe try to provide a minimal example of what you're trying to do :)
<dualfade> like - Base64.strict_decode64(URI.decode_www_form(str)).split('--')[1]
<jhass> where's your input coming from?
<dualfade> defined string url base64 encoded string
<jhass> got an example?
<dualfade> Im working on a ptlabs challenge
<dualfade> "YWRtaW4yLS0wRQIhAP%2F5e9V1Xu6kIEU6FDVSNdOC9kcvhWihiy8FehRgKXVWAiBlXnTiAJK8UStUPSkJGULEX%2Bcs5J5FvcscBKiuVSh5ag%3D%3D"
<dualfade> and taking my 1st stab at ruby haha
TakumoK has joined #ruby
doomlist3 has joined #ruby
<dualfade> 1st thank you guys. very helpful. Very promising ;)
<jhass> Base64.decode64(URI.decode(s))[/.+(?=--)/, 0] seems to work
<dualfade> ok let me try that.
Takumo has quit [Ping timeout: 256 seconds]
<dualfade> huh ok maybe Im calling a def wrong I guess.
<dualfade> coming from python here
<dualfade> this is the same error "`url_base64_decode': undefined method `type' for main:Object (NoMethodError)"
<dualfade> Ill play with it. Thank you.
<jhass> yeah seems to have nothing to do with the code you've shown :)
reyfi9e has quit [*.net *.split]
arekushi has quit [*.net *.split]
mbarbar has quit [*.net *.split]
Fusl has quit [*.net *.split]
Fusl has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
reyfi9e has joined #ruby
Garb0 has quit [Quit: I'm out.]
nicholaslyang has joined #ruby
<dualfade> out of curiousity what version of ruby are you on ?
<dualfade> ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
nicholaslyang has quit [Client Quit]
<jhass> sameish
arekushi has joined #ruby
mbarbar has joined #ruby
<jhass> (it really doesn't make a difference for what we talked about)
drincruz has joined #ruby
<apotheon> ta: This is going to make my standard farewell more difficult.
<apotheon> ta: I didn't even know there was someone with that name here.
mikecmpbll has joined #ruby
TakumoK is now known as Takumo
jingjinghack has quit [Quit: WeeChat 2.1]
<ta> apotheon: ;)
iNs has quit [Remote host closed the connection]
<apotheon> I say goodbye / And you say hello
<apotheon> (to paraphrase the song)
iNs has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
doomlist3 has quit [Ping timeout: 260 seconds]
Lazarus2 has joined #ruby
bvdw has quit [Remote host closed the connection]
lazarus1 has quit [Ping timeout: 260 seconds]
TCZ has joined #ruby
bvdw has joined #ruby
doomlist3 has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
bvdw has quit [Remote host closed the connection]
<AndreYuhai> Why do I get undefined method 'update' for nil:NilClass error here: https://dpaste.org/3DJ9 ? If I define a method directly inside of the User class instead of including the module then it works.
bvdw has joined #ruby
<AndreYuhai> I mean I just did this: https://dpaste.org/4PRh inside the User class and I had no errors.
<AndreYuhai> prefixing with self also works.
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
jinie has joined #ruby
<adam12> AndreYuhai: So the exception would point to line 21 in your paste?
<AndreYuhai> adam12, yes, sorry I forgot to mention that
<adam12> AndreYuhai: Np. I kinda figured but it helps to know exact line numbers.
<adam12> AndreYuhai: Out of curiosity, can you change entry_count = to be self.entry_count =
<adam12> AndreYuhai: It's hard to follow without a stacktrace but you're doing an assignment inside the ternary but it looks unused. Maybe it's eventually going to be used?
<AndreYuhai> adam12, Yes, I just tried it once and it worked but let me make sure.
<AndreYuhai> adam12, that assignment is actually for the entry_count of the User like self.entry_count = EntryCount.new ...
stryek has joined #ruby
gell5 has joined #ruby
kiwi_83 has joined #ruby
<adam12> AndreYuhai: So you definitely need self there then, because without it, Ruby thinks you're assigning a local variable. self.entry_count= is a method call.
<AndreYuhai> adam12, but then if the ternary evaluates to false, shouldn't the false part just execute without any problem?
<adam12> AndreYuhai: Yes. But somehow you're getting nil there. It's hard to know without a stack trace.
kiwi_83 has quit [Quit: Connection closed]
gell5 has quit [Ping timeout: 256 seconds]
ellcs1 has joined #ruby
<AndreYuhai> adam12, when I put self, everything works fine. Thank you :)
sarna has quit [Quit: Connection closed]
alexherbo2 has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
SeepingN has joined #ruby
ChmEarl has joined #ruby
dionysus69 has joined #ruby
conta has quit [Quit: conta]
TCZ is now known as DOMSlayer2020
banisterfiend has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
rippa has joined #ruby
nychtel has joined #ruby
DOMSlayer2020 is now known as TCZ
orbyt_ has joined #ruby
gato has joined #ruby
Lazarus2 has quit [Quit: Leaving]
nicholaslyang has joined #ruby
buckworst has quit [Quit: WeeChat 2.8]
nicholaslyang has quit [Client Quit]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
chris____ has joined #ruby
alexherbo29 has joined #ruby
alexherbo2 has quit [Ping timeout: 264 seconds]
alexherbo29 is now known as alexherbo2
lucasb has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
TCZ has quit [Quit: Leaving]
mikecmpbll has quit [Ping timeout: 264 seconds]
nychtel has quit [Ping timeout: 256 seconds]
nychtel has joined #ruby
mikecmpbll has joined #ruby
havenwood has quit [Quit: ZNC 1.8.0 - https://znc.in]
havenwood has joined #ruby
havenwood has joined #ruby
Nielson has joined #ruby
nychtel has quit [Ping timeout: 265 seconds]
nychtel has joined #ruby
gato has quit [Ping timeout: 246 seconds]
kgrz has joined #ruby
kgrz has quit [Client Quit]
kgrz has joined #ruby
Nielson has quit [Remote host closed the connection]
kgrz has quit [Client Quit]
gell5 has joined #ruby
gell5 has quit [Ping timeout: 258 seconds]
buckworst has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
wald0 has joined #ruby
chris____ has quit [Ping timeout: 256 seconds]
nicholaslyang has joined #ruby
buckworst has quit [Quit: WeeChat 2.8]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nicholaslyang has joined #ruby
cd has joined #ruby
xco has joined #ruby
pwnd_nsfw` has joined #ruby
duderonomy has joined #ruby
pwnd_nsfw has quit [Ping timeout: 264 seconds]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kloeri has quit [Remote host closed the connection]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
kloeri has joined #ruby
cliluw has joined #ruby
ur5us has joined #ruby
cliluw has quit [Ping timeout: 256 seconds]
cliluw has joined #ruby
howdoi has joined #ruby
mikecmpbll has quit [Ping timeout: 260 seconds]
mikecmpbll has joined #ruby
alexherbo2 has quit [Ping timeout: 246 seconds]
chamunks- has quit [Quit: Don't worry I'm not gone yet.]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
ur5us has quit [Ping timeout: 256 seconds]
sauvin has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
kristian_on_linu has joined #ruby
gell5 has joined #ruby
chamunks has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
vondruch has quit [Ping timeout: 264 seconds]
<doomlist3> if (i<4) then ... vs if i<4 ... what's the difference , while ... do vs while and for ... do vs for ...
nicholaslyang has joined #ruby
gell5_ has joined #ruby
gell5 has quit [Ping timeout: 246 seconds]
leitz has joined #ruby
roadie has quit [Ping timeout: 272 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
<adam12> doomlist3: then is optional for if. When used with case when it allows same-line conditional and logic (ie. when foo then do_bar)
<adam12> doomlist3: do/end is a block construct. It's sometimes also { and } but not always, since {} can be used to construct a Hash.
<doomlist3> while ... do ... is it equivalent to while ...
wald0 has quit [Quit: Lost terminal]
<adam12> doomlist3: In the case of while, the `do` piece is optional. This is the same for `for` since they are both keywords.
ncakerlist has joined #ruby
<ncakerlist> is there a link that explains this while do end vs while end
<adam12> doomlist3: while is normally used for a conditional, less so for a loop. for is usually frowned upon for loops since Ruby has an Enumerable module with lots of nice things in it (upto, step, times, etc)
<ncakerlist> how can while be a conditional like if, when it's a loop ... and if used for conditional why not just if elsif
doomlist3 has quit [Ping timeout: 246 seconds]
<al2o3-cr> ncakerlist: while will always be a loop
<adam12> ncakerlist: while (line = getch); puts line; end
<adam12> ncakerlist: In this case I'm cheating and performing an assignment inside the conditional. In Ruby, anything not false or nil is true. So the return value of gets would keep the loop going forever until aborted.
<adam12> s/getch/gets/
<ncakerlist> NameError (undefined local variable or method `getch' for main:Object)
<ncakerlist> adam12: you write bad code
<ncakerlist> ya gets
<ncakerlist> this is a fundamental mistake and even a one-dayer on ruby can figure out
<ncakerlist> by the way i like ruby's design different from python and willing to explore
<ncakerlist> i also like the blocks concept
<al2o3-cr> ncakerlist: STDIN.getch
<ncakerlist> also i like Math.sqrt(9) works out of the box.. without require how does ruby not require modules
<al2o3-cr> ncakerlist: 9 ** 0.5 too
<ncakerlist> is there a file where i can pre-load module names
<al2o3-cr> ncakerlist: autoload file
<ncakerlist> thx
<al2o3-cr> np
<al2o3-cr> ncakerlist: autoload class, file
<ncakerlist> || works just like or? are they same
<ncakerlist> I see i can use or,and just like ||,&&
<ncakerlist> for booleans not bitwise
<al2o3-cr> ncakerlist: || as higher precedence
<al2o3-cr> same with &&
BTRE has quit [Remote host closed the connection]
<al2o3-cr> ncakerlist: you'll love the block concept and never go back :P
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
dviola has quit [Quit: WeeChat 2.8]
dviola has joined #ruby
<al2o3-cr> ncakerlist: why do you pass self to every method definition within a class in Python?
roadie has joined #ruby
<al2o3-cr> ncakerlist: why do list comprehensions read backward
gix has joined #ruby
<al2o3-cr> ncakerlist: and what's with all that whitespace? yuk!
roadie has quit [Ping timeout: 256 seconds]
<al2o3-cr> anything python can do, ruby can do too. it's an interpeted language ffs.
ur5us has quit [Ping timeout: 260 seconds]
Garb0 has joined #ruby
chalkmonster has joined #ruby
infinityfye has quit [Read error: Connection reset by peer]
infinityfye has joined #ruby
Jonopoly has joined #ruby
ncakerlist has quit [Ping timeout: 256 seconds]
TCZ has joined #ruby
roadie has joined #ruby
akem has quit [Ping timeout: 264 seconds]
<al2o3-cr> beat this exc size
<al2o3-cr> &>> Struct.new(:foo) { define_method(:initialize) { |foo = rand(42) | super } }.new rescue $!.message
<rubydoc> # => "implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly." (https://carc.in/#/r/98ww)
<al2o3-cr> that's a whopper
jimeh has quit []
jimeh has joined #ruby
roshanavand has joined #ruby
roshanavand has quit [Client Quit]
roshanavand has joined #ruby
roadie has quit [Ping timeout: 272 seconds]
roadie has joined #ruby
Mia has quit [Quit: Leaving]
troulouliou_div2 has joined #ruby
r3m has quit [Quit: WeeChat 2.9-dev]
r3m has joined #ruby
snyp has joined #ruby
r3m has quit [Client Quit]
r3m has joined #ruby
Garb0_ has joined #ruby
chris____ has joined #ruby
Garb0 has quit [Ping timeout: 264 seconds]
roadie has quit [Ping timeout: 256 seconds]
chris____ has quit [Ping timeout: 264 seconds]
akem has joined #ruby
akem has quit [Max SendQ exceeded]
akem has joined #ruby
presiden has joined #ruby
<snyp> Can't understand why this error is appearing - https://privatebin.net/?7a8fd9594f692671#AyyAPWLK2L89hSyrfMbFuWAT7GkfG2hhG3GDcmeL7L1T - the function does take 3 args and when I use binding.pry and call the function _without parens for the arg list_ it works.
<snyp> so strange
<snyp> any idea?
kristian_on_linu has quit [Remote host closed the connection]
ellcs1 has quit [Ping timeout: 256 seconds]
<al2o3-cr> lol then
Garb0__ has joined #ruby
<al2o3-cr> with p.send
dionysus69 has quit [Ping timeout: 260 seconds]
banisterfiend has quit [Read error: Connection reset by peer]
<al2o3-cr> doomlist3 aliases.
Garb0_ has quit [Ping timeout: 256 seconds]
<al2o3-cr> snyp: been around the block if you know what i mean. joker.
jetchisel has joined #ruby
ur5us has joined #ruby
<havenwood> snyp: p.send(:send, restaurant, notification, country_code)
roadie has joined #ruby
<havenwood> snyp: It's usually preferable to use #public_send, anyways.
<havenwood> snyp: p.public_send(:send, restaurant, notification, country_code)
<kaleido> is rubygems part of ruby now? or still a separate install?
<havenwood> snyp: `p` is a bad local variable name.
<havenwood> kaleido: RubyGems has shipped with Ruby for over a decade.
<havenwood> kaleido: Bundler is now merged with RubyGems, and ships with Ruby as well.
<havenwood> kaleido: See: https://stdgems.org/
<kaleido> thanks
<snyp> havenwood: what do you mean public_send?
<havenwood> &>> defined? send
<rubydoc> # => "method" (https://carc.in/#/r/98x9)
TCZ has quit [Quit: Leaving]
<havenwood> &>> defined? pubilc_send
<rubydoc> # => nil (https://carc.in/#/r/98xa)
<havenwood> &>> defined? public_send
<rubydoc> # => "method" (https://carc.in/#/r/98xb)
<havenwood> &>> method(:send).owner
<rubydoc> # => Kernel (https://carc.in/#/r/98xc)
<havenwood> &>> self.class.ancestors.include? Kernel
<rubydoc> # => true (https://carc.in/#/r/98xd)
<havenwood> snyp: It's a bit confusing because of the #send method name.
roadie has quit [Ping timeout: 272 seconds]
<havenwood> snyp: In your example code, what is `p`?
<havenwood> snyp: My guess is that you're calling Kernel#send not the method you're hoping.
r3m has quit [Quit: WeeChat 2.9-dev]
<havenwood> snyp: Check: p.method(:send).owner
<havenwood> snyp: Is it Kernel?
<havenwood> snyp: Kernel#p is another method available on most objects. Is `p` a local variable here? It's the worst single letter to use as a variable.
<havenwood> &>> p.class
<rubydoc> # => NilClass (https://carc.in/#/r/98xe)
<havenwood> &>> method(:p).owner
<rubydoc> # => Kernel (https://carc.in/#/r/98xf)
<havenwood> snyp: Show more code or say more if this isn't helping?
AndreYuhai has quit [Quit: Leaving]
r3m_ has joined #ruby
evdubs has quit [Quit: Leaving]
r3m_ is now known as r3m
evdubs has joined #ruby
infinityfye has quit [Ping timeout: 256 seconds]
deathwishdave has joined #ruby
akem_ has joined #ruby
deathwishdave has quit [Client Quit]
akem has quit [Ping timeout: 260 seconds]
Jonopoly has quit [Quit: WeeChat 2.8]
Garb0__ has quit [Read error: Connection reset by peer]
Garb0 has joined #ruby
Garb0 has quit [Read error: Connection reset by peer]
Garb0 has joined #ruby
BTRE has joined #ruby
r3m has quit [Quit: WeeChat 2.9-dev]
r3m has joined #ruby
imode has joined #ruby
gfawcett has quit [Ping timeout: 256 seconds]
schne1der has quit [Ping timeout: 265 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<ule> havenwood: we pushed the ruby + jemalloc to production today
<ule> havenwood: memory is beautiful, but overall, sidekiq workers are taking much longer to run the jobs
greypack has quit [Ping timeout: 246 seconds]
<ule> havenwood: not sure why, but looks like jemalloc or sidekiq is kind of throttling memory
snyp has quit [Quit: WeeChat 2.8]
<havenwood> ule: What are the jobs doing that takes time?
<ule> They are csv importers..
<havenwood> ule: Hem, interesting.
<ule> Before, it was taking ~5 minutes.. now it is taking ~35
<ule> :/
<ule> I'll see how it goes in the next 24 hours.. maybe try to optimize something on this importer.. otherwise, maybe rollback the jemalloc
<ule> :/
akem_ has quit [Ping timeout: 246 seconds]
<ule> I actually did multiple upgrades today at the same time.. Rails 5.1 to 5.2, Sikdei 5.1 to 5.2, and Ruby 2.6.3 to 2.6.6 + jemalloc
<ule> *Sidekiq
<ule> havenwood: If it weren't for this speed issue, everything would be fantastic.. the memory is so low now, you have no idea :P
<ule> I wish I could re-write those importers in Golang
<havenwood> mmmm
<ule> Now that I have Rails 5.2, maybe I can try Ruby 2.7 as well
<ule> Do you guys know if there is any improvement in performance or memory in the 2.7 version?
mikecmpbll has quit [Quit: inabit. zz.]
poro has joined #ruby
sagax has quit [Remote host closed the connection]
<havenwood> ule: Yes, there are nice performance improvements in 2.7. 🚀
<havenwood> ule: If jemalloc is funky (that's actually strange and I'm curious) then maybe consider malloc_trim() with malloc.
<havenwood> Future think: GC.start(compact: true, malloc_trim: true)
postmodern has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leitz has quit [Quit: Leaving]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
quazimodo has quit [Ping timeout: 265 seconds]
plutes has quit [Ping timeout: 272 seconds]
poro has quit [Quit: Leaving]
nicholaslyang has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
plutes has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
greypack has joined #ruby
greypack has quit [Client Quit]
impermanence has joined #ruby
greypack has joined #ruby
gell5_ has quit [Remote host closed the connection]
venmx has quit [Quit: leaving]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]