havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.0, 2.6.5, 2.5.7: 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!
<TCZ> &>> require 'matrix'; Vector[1,2,3] + Vector[4,5,6]
<rubydoc> # => Vector[5, 7, 9] (https://carc.in/#/r/8loo)
simonfromspace has quit [Ping timeout: 255 seconds]
splud_wurk has quit [Quit: splud_wurk]
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul> TCZ or that, if you insist :)
davidw has quit [Ping timeout: 258 seconds]
splud_wurk has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
<TCZ> or i can write my + method for Arrays ;p
TCZ has quit [Quit: Leaving]
<havenwood> &>> [1,2,3].zip([4,5,6]).map(&:sum)
<rubydoc> # => [5, 7, 9] (https://carc.in/#/r/8lot)
<havenwood> &>> result = []; [1, 2, 3].zip([4, 5, 6]) { result << _1 + _2 }; result
<rubydoc> # => [5, 7, 9] (https://carc.in/#/r/8lou)
davidw has joined #ruby
<havenwood> &>> [[1, 2, 3], [4, 5, 6]].transpose.map(&:sum)
<rubydoc> # => [5, 7, 9] (https://carc.in/#/r/8lov)
<havenwood> I like the Vectors.
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gheegh has joined #ruby
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DaRock has quit [Read error: Connection reset by peer]
DaRock has joined #ruby
citizentwo has joined #ruby
gheegh has joined #ruby
citizentwo has quit [Ping timeout: 240 seconds]
DaRock has quit [Read error: Connection reset by peer]
DaRock has joined #ruby
impermanence has quit [Remote host closed the connection]
TCZ has joined #ruby
ryzokuken has quit [Ping timeout: 246 seconds]
raggi- has quit [Ping timeout: 246 seconds]
raggi- has joined #ruby
gmcintire has quit [Ping timeout: 246 seconds]
danguita has quit [Ping timeout: 246 seconds]
phaul has quit [Ping timeout: 240 seconds]
cc_ has joined #ruby
davidw has quit [Ping timeout: 240 seconds]
ryzokuken has joined #ruby
gmcintire has joined #ruby
phaul has joined #ruby
danguita has joined #ruby
markopasha has quit [Read error: Connection reset by peer]
cc__ has joined #ruby
cc_ has quit [Ping timeout: 265 seconds]
m_antis has quit [Quit: m_antis]
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gheegh has joined #ruby
m_antis has joined #ruby
m_antis has quit [Client Quit]
gheegh has quit [Client Quit]
_phaul has joined #ruby
TinderFX has joined #ruby
alfiemax has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
alfiemax has quit [Ping timeout: 240 seconds]
orbyt_ has joined #ruby
citizentwo has joined #ruby
splud_wurk has quit [Quit: splud_wurk]
citizentwo has quit [Ping timeout: 240 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sergioro has joined #ruby
DaRock has quit [Read error: Connection reset by peer]
DaRock has joined #ruby
gheegh has joined #ruby
cd has quit [Quit: cd]
m_antis has joined #ruby
citizentwo has joined #ruby
m_antis is now known as m_antis[away]
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tempesta has quit [Quit: AdiIRC is updating to v3.8 Beta Build (2020/02/18 UTC) 64 Bit]
Tempesta has joined #ruby
m_antis[away] is now known as m_antis
m_antis is now known as m_antis[away]
simonfromspace has joined #ruby
m_antis[away] is now known as m_antis
m_antis is now known as m_antis[away]
citizentwo has quit [Remote host closed the connection]
postmodern has joined #ruby
Tempesta has quit [Quit: See ya!]
m_antis[away] is now known as m_antis
coderhs has quit [Remote host closed the connection]
m_antis is now known as m_antis[away]
bvdw has quit [Read error: Connection reset by peer]
Tempesta has joined #ruby
bvdw has joined #ruby
teardown has joined #ruby
ttoocs has joined #ruby
lineus has quit [Ping timeout: 240 seconds]
simonfromspace has quit [Quit: Leaving]
r3m has quit [Quit: WeeChat 2.8-dev]
r3m has joined #ruby
jenrzzz_ has quit [Ping timeout: 255 seconds]
lineus has joined #ruby
m_antis[away] has quit [Quit: m_antis[away]]
duderonomy has joined #ruby
TCZ has quit [Quit: Leaving]
cc__ has quit [Remote host closed the connection]
jenrzzz has joined #ruby
Arahael has quit [Ping timeout: 265 seconds]
jenrzzz has quit [Ping timeout: 265 seconds]
Arahael has joined #ruby
drincruz has joined #ruby
braincrash has quit [Quit: bye bye]
alfiemax has joined #ruby
braincrash has joined #ruby
ur5us_ has quit [Ping timeout: 248 seconds]
gix has quit [Ping timeout: 258 seconds]
heth has quit [Read error: Connection reset by peer]
fphilipe_ has joined #ruby
TinderFX has quit [Ping timeout: 240 seconds]
fphilipe has quit [Ping timeout: 240 seconds]
MrCrackPot has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
heth has joined #ruby
postmodern has quit [Quit: Leaving]
gheegh has joined #ruby
sagax has joined #ruby
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
drincruz has quit [Ping timeout: 265 seconds]
phaul has joined #ruby
_phaul has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
Furai has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 265 seconds]
Furai has joined #ruby
Arahael has quit [Ping timeout: 255 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mossplix has joined #ruby
LinuxKnight has joined #ruby
zapata has quit [Quit: WeeChat 2.7]
sauvin has joined #ruby
Arahael has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
Swyper has quit [Remote host closed the connection]
mnemon has quit [Remote host closed the connection]
Arahael has quit [Ping timeout: 240 seconds]
NODE has quit [Client Quit]
NODE has joined #ruby
xco has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
mossplix has quit [Remote host closed the connection]
Swyper has joined #ruby
buckworst has quit [Quit: WeeChat 2.7]
mossplix has joined #ruby
Arahael has joined #ruby
cthulchu_ has quit [Ping timeout: 268 seconds]
Qablae has joined #ruby
<Qablae> hi, please kindly stay out of #freenode. the pool is closed. thanks.
<Qablae> hi, please kindly stay out of #freenode. the pool is closed. thanks.
<Qablae> hi, please kindly stay out of #freenode. the pool is closed. thanks.
Qablae has left #ruby [#ruby]
Arahael has quit [Ping timeout: 260 seconds]
droklatek has joined #ruby
<droklatek> hi, please kindly stay out of #freenode. the pool is closed. thanks.
<droklatek> hi, please kindly stay out of #freenode. the pool is closed. thanks.
<droklatek> hi, please kindly stay out of #freenode. the pool is closed. thanks.
droklatek has left #ruby ["hi, please kindly stay out of #freenode. the pool is closed. thanks."]
aphoi has joined #ruby
<aphoi> hi, please kindly stay out of #freenode. the pool is closed. thanks.
<aphoi> hi, please kindly stay out of #freenode. the pool is closed. thanks.
<aphoi> hi, please kindly stay out of #freenode. the pool is closed. thanks.
aphoi has left #ruby [#ruby]
aphoi has joined #ruby
<aphoi> hi, please kindly stay out of #freenode. the pool is closed. thanks.
<aphoi> hi, please kindly stay out of #freenode. the pool is closed. thanks.
<aphoi> hi, please kindly stay out of #freenode. the pool is closed. thanks.
aphoi has left #ruby [#ruby]
Oblo has joined #ruby
Oblo has left #ruby ["hi, please kindly stay out of #freenode. the pool is closed. thanks."]
kraacr has joined #ruby
fphilipe_ has quit [Ping timeout: 240 seconds]
kraacr has left #ruby ["hi, please kindly stay out of #freenode. the pool is closed. thanks."]
fphilipe_ has joined #ruby
Swyper has quit [Remote host closed the connection]
aceoleeye has joined #ruby
<aceoleeye> hi, please kindly stay out of #freenode. the pool is closed. thanks.
<aceoleeye> hi, please kindly stay out of #freenode. the pool is closed. thanks.
<aceoleeye> hi, please kindly stay out of #freenode. the pool is closed. thanks.
aceoleeye has left #ruby [#ruby]
<lunarkitty> what?
hoijui has joined #ruby
clemens3 has quit [Quit: WeeChat 2.7]
fphilipe_ has quit [Ping timeout: 260 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
Arahael has joined #ruby
conta has joined #ruby
hoijui has quit [Quit: Leaving]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
fphilipe_ has joined #ruby
Arahael has quit [Ping timeout: 240 seconds]
StoneCypherWork has joined #ruby
<StoneCypherWork> I'm trying to remove the `SameSite` claim from a cookie that I'm sending in Rack, but I'm not a ruby programmer, and I'm having trouble figuring out how to perform the edit
<StoneCypherWork> If someone has some time for some rudimentary help, it'd be appreciated
zapata has joined #ruby
_phaul has joined #ruby
phaul has quit [Ping timeout: 255 seconds]
<StoneCypherWork> i worry a bit that it might be too late at night to get help
<lunarkitty> I've never used rack directly
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<lunarkitty> you usually have to wait a while to get an answer
bvdw has quit [Read error: Connection reset by peer]
TomyWork has joined #ruby
bvdw has joined #ruby
clemens3 has joined #ruby
_Joes_ has quit [Remote host closed the connection]
Arahael has joined #ruby
<StoneCypherWork> i'm about 70% confident i have the right thing here
Arahael has quit [Ping timeout: 258 seconds]
<StoneCypherWork> lunarkitty: could i get you to take a look just in the name of common sense?
<StoneCypherWork> it's just the bit headers['Set-Cookie'].sub! '; SameSite=Strict' ''
<StoneCypherWork> i just want to remove that string fragment from headers['Set-Cookie']
<StoneCypherWork> repeatedly
<_phaul> headers['Set-Cookie'] = '' ? Or headers.delete('Set-Cookie')
<StoneCypherWork> i don't want to remove the whole cookie
<StoneCypherWork> just the substring (repeatedly)
<_phaul> ah. sub replaces ones. gsub does repeatedly
<StoneCypherWork> oh, ok
<StoneCypherWork> was i correct to put the bang there to get in-place edits?
<_phaul> also therre is a comma missing between the arguments
<StoneCypherWork> it's "foo".gsub! "a", "b" ?
<lunarkitty> Oh sorry, I didn't see anything til jsut now
<StoneCypherWork> hey no worries, i'm asking for 1a help, pauses are not unreasonable
<_phaul> &>> a = 'yes'; a.gsub!('e', 'a'); a
<rubydoc> # => "yas" (https://carc.in/#/r/8lqw)
<StoneCypherWork> ok great thanks
<StoneCypherWork> i thiiiiiiiiiiiiiiiiiiiink this might be done
vondruch has joined #ruby
cvz has quit [Quit: WeeChat 2.7]
darkstardev13 has joined #ruby
raven__ has quit [Ping timeout: 245 seconds]
Bounga` has joined #ruby
Bounga` is now known as Bounga
chalkmonster has joined #ruby
pinpox- has joined #ruby
pinpox has quit [Ping timeout: 260 seconds]
fphilipe_ has quit [Ping timeout: 255 seconds]
Bounga has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
Bounga has joined #ruby
fphilipe_ has joined #ruby
Arahael has joined #ruby
plutes has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
StoneCypherWork has quit [Ping timeout: 258 seconds]
conta has quit [Quit: conta]
st0m4 has joined #ruby
StoneCypherWork has joined #ruby
jmcgnh has quit [Read error: Connection reset by peer]
StoneCypherWork has quit [Ping timeout: 268 seconds]
jmcgnh has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 258 seconds]
GodFather has quit [Read error: Connection reset by peer]
GodFather has joined #ruby
pinpox- is now known as pinpox
lxsameer has joined #ruby
code_zombie has quit [Quit: Leaving]
jmcgnh has quit [Read error: Connection reset by peer]
leitz has quit [Quit: Leaving]
dionysus69 has joined #ruby
apotheon has quit [Ping timeout: 265 seconds]
jmcgnh has joined #ruby
apotheon has joined #ruby
cisco has joined #ruby
mossplix has quit [Remote host closed the connection]
fanta1 has joined #ruby
darkstardevx has quit [Remote host closed the connection]
darkstardevx has joined #ruby
m_antis has joined #ruby
mossplix has joined #ruby
darkstardevx has quit [Remote host closed the connection]
darkstardevx has joined #ruby
jenrzzz has joined #ruby
StoneCypherWork has joined #ruby
StoneCypherWork has quit [Ping timeout: 240 seconds]
TCZ has joined #ruby
darkstardev13 has quit [Ping timeout: 240 seconds]
darkstardevx has quit [Ping timeout: 240 seconds]
Fernando-Basso has joined #ruby
darkstardevx has joined #ruby
darkstardev13 has joined #ruby
ctOS has joined #ruby
alexherbo2 has joined #ruby
ellcs has quit [Remote host closed the connection]
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
mossplix has quit [Read error: Connection reset by peer]
mossplix has joined #ruby
pinpox has quit [Ping timeout: 260 seconds]
pinpox has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
mossplix has quit [Ping timeout: 240 seconds]
ellcs has joined #ruby
fanta1 has quit [Quit: fanta1]
TCZ has quit [Ping timeout: 258 seconds]
TCZ has joined #ruby
TCZ has quit [Remote host closed the connection]
plutes has quit [Read error: Connection reset by peer]
gheegh has joined #ruby
alfiemax has quit [Remote host closed the connection]
TCZ has joined #ruby
braincrash has quit [Ping timeout: 240 seconds]
braincrash has joined #ruby
silviu23 has quit [Remote host closed the connection]
silviu has joined #ruby
SoF has quit [Quit: Ping timeout (120 seconds)]
SoF has joined #ruby
cisco has quit [Remote host closed the connection]
StoneCypherWork has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.7]
alfiemax has joined #ruby
chalkmonster has joined #ruby
lucasb has joined #ruby
StoneCypherWork has quit [Ping timeout: 258 seconds]
st0m4 has quit [Quit: leaving]
burningserenity has joined #ruby
drincruz has joined #ruby
DaRock has quit [Read error: Connection reset by peer]
DaRock has joined #ruby
Arahael has quit [Ping timeout: 255 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
drincruz has quit [Ping timeout: 240 seconds]
drincruz has joined #ruby
TCZ has quit [Quit: Leaving]
Swyper has joined #ruby
mossplix has joined #ruby
drincruz has quit [Ping timeout: 258 seconds]
al2o3-cr has quit [Ping timeout: 256 seconds]
chalkmonster has quit [Quit: WeeChat 2.7]
chalkmonster has joined #ruby
mossplix has quit [Remote host closed the connection]
simonfromspace has joined #ruby
markopasha has joined #ruby
TCZ has joined #ruby
alfiemax has quit [Remote host closed the connection]
markopasha has quit [Remote host closed the connection]
bsdbandit-01 has quit [Ping timeout: 258 seconds]
burningserenity has quit [Ping timeout: 260 seconds]
jmcgnh has quit [Ping timeout: 240 seconds]
bsdband2 has joined #ruby
jmcgnh has joined #ruby
minall has joined #ruby
Arahael has joined #ruby
fanta1 has joined #ruby
bsdbandit-01 has joined #ruby
jintseng has joined #ruby
phaul has joined #ruby
bsdband2 has quit [Ping timeout: 255 seconds]
royal_screwup21 has joined #ruby
royal_screwup21 has quit [Remote host closed the connection]
dionysus69 has quit [Ping timeout: 240 seconds]
_phaul has quit [Ping timeout: 255 seconds]
Ytrezar has quit [Quit: See ya]
burningserenity has joined #ruby
Ytrezar has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
duderonomy has joined #ruby
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
minall has quit [Remote host closed the connection]
poontangmessiah has joined #ruby
minall has joined #ruby
duderonomy has quit [Client Quit]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
lxsameer has quit [Quit: WeeChat 2.6]
royal_screwup21 has joined #ruby
pupsikov has joined #ruby
StoneCypherWork has joined #ruby
royal_screwup21 has quit [Remote host closed the connection]
cisco has joined #ruby
StoneCypherWork has quit [Ping timeout: 260 seconds]
drincruz has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.7]
al2o3-cr has joined #ruby
al2o3-cr has quit [Client Quit]
al2o3-cr has joined #ruby
jmcgnh has quit [Ping timeout: 268 seconds]
john2496 has joined #ruby
prestorium has joined #ruby
royal_screwup21 has joined #ruby
jmcgnh has joined #ruby
poontangmessiah has quit [Ping timeout: 240 seconds]
poontangmessiah has joined #ruby
royal_screwup21 has quit [Remote host closed the connection]
TCZ has quit [Ping timeout: 240 seconds]
leitz has joined #ruby
DaRock has quit [Ping timeout: 258 seconds]
jintseng has quit [Ping timeout: 240 seconds]
duderonomy has joined #ruby
poontangmessiah has quit [Ping timeout: 258 seconds]
ellcs has quit [Ping timeout: 248 seconds]
poontangmessiah has joined #ruby
_phaul has joined #ruby
phaul has quit [Ping timeout: 255 seconds]
chalkmonster has joined #ruby
burningserenity has quit [Ping timeout: 255 seconds]
jintseng has joined #ruby
ellcs has joined #ruby
StoneCypherWork has joined #ruby
burningserenity has joined #ruby
stryek has joined #ruby
Ytrezar has quit [Quit: See ya]
Ytrezar has joined #ruby
ttoocs has quit [Ping timeout: 255 seconds]
TorpedoSkyline has joined #ruby
StoneCypherWork has quit [Ping timeout: 240 seconds]
burningserenity has quit [Ping timeout: 248 seconds]
<simonfromspace> havenwood, good morning! Whenever you get some time, kindly explain why you suggested me to put those modules inside a class. I mean, it works, but I was questioned about it and I didn't know what to say.
StoneCypherWork has joined #ruby
poontangmessiah has quit [Ping timeout: 240 seconds]
<havenwood> simonfromspace: In Ruby, the top level namespace are the constants on Object. Your library should only be adding one, not many. If everyone adds many, we'll stomp on each other and break code.
<havenwood> &>> Object.constants
<rubydoc> # => [:SystemExit, :IO, :SignalException, :Interrupt, :StandardError, :TypeError, :ArgumentError, :IndexError,... check link for more (https://carc.in/#/r/8lt9)
<havenwood> simonfromspace: Your library shouldn't be polluting the top level namespace with JSON, Formatter—some that already exist and some that others will make.
<havenwood> simonfromspace: By having them under EZTVScraper, it's *your* JSON, not stlib JSON.
poontangmessiah has joined #ruby
<havenwood> simonfromspace: Leaking top level constants should't make it past code review.
StoneCypherWork has quit [Ping timeout: 240 seconds]
<havenwood> simonfromspace: Imagine your JSON has a JSON.generate method. By loading your library, you just broke every other gem and parts of the stdlib.
clemens3 has quit [Quit: WeeChat 2.7]
<havenwood> simonfromspace: If your EZTVScraper::JSON has a EZTVScraper::JSON.generate, no problem whatsoever.
clemens3 has joined #ruby
<havenwood> simonfromspace: With the EZTVScraper gem, you're claiming any namespace under EZTVScraper for your gem and plugins for your gem.
<havenwood> simonfromspace: Does that make sense?
SuperL4g is now known as SuperLag
cd has joined #ruby
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
royal_screwup21 has joined #ruby
sergioro has quit [Quit: leaving]
TorpedoSkyline has joined #ruby
ellcs has quit [Ping timeout: 240 seconds]
<nahmanreally> isn't EZTV warez?
<havenwood> nahmanreally: Is it? I'm not familiar with it.
<nahmanreally> havenwood: Pretty sure it is :/
fig-le-deunch has joined #ruby
<nahmanreally> Sounds familiar. Remember I had one of The Pirate Bay owners asking me to redo their website and branding. EZTV were one of the release groups that appared most frequently on that site.
<nahmanreally> He only asked me because we were from the same city though, not because I was involved in piracy.
alexherbo2 has joined #ruby
clemens3 has quit [Ping timeout: 265 seconds]
cisco has quit [Remote host closed the connection]
TomyWork has quit [Read error: Connection reset by peer]
ellcs has joined #ruby
fig-le-deunch has quit [Quit: Konversation terminated!]
LinuxKnight has quit [Ping timeout: 255 seconds]
poontangmessiah has quit [Ping timeout: 265 seconds]
alexherbo22 has joined #ruby
alexherbo2 has quit [Ping timeout: 255 seconds]
alexherbo22 is now known as alexherbo2
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cthulchu_ has joined #ruby
nowhereman has joined #ruby
royal_screwup21 has quit [Remote host closed the connection]
sagax has quit [Remote host closed the connection]
prestorium has quit [Ping timeout: 258 seconds]
_whitelogger has quit [Ping timeout: 248 seconds]
_whitelogger has joined #ruby
TorpedoSkyline has joined #ruby
gix has joined #ruby
impermanence has joined #ruby
citizentwo has joined #ruby
rippa has joined #ruby
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<simonfromspace> havenwood, I am 90% sure I understand what you've said. What keyword do I search on Google to learn more about this?
splud_wurk has joined #ruby
<simonfromspace> al2o3-cr, thank you kind sir!
<havenwood> simonfromspace: Which part seems iffy? Want another example of defining a method on a shared class that breaks things?
<simonfromspace> I assumed modules and classes were to be used separately. What you suggested honestly blew my mind. The code reviewer even basically said "I made an observation in your code. Classes were used to wrap modules.I suggest you read again on the differences between classes and modules. The two are different concepts that have unique purpose."
<al2o3-cr> that code reviewer sucks.
<simonfromspace> I mean, I trust the advice here more than anything but it just seems wild from a noobs perspective.
<simonfromspace> I would like to see those if you can think of any, havenwood , and also code where Modules are bundled inside Classes.
<simonfromspace> Found some examples on that Rubymonk page from al2o3-cr
codefriar has quit [Ping timeout: 272 seconds]
scipio_africanu4 has quit [Ping timeout: 240 seconds]
<al2o3-cr> simonfromspace: ruby has single inheritance.
batisi[m] has quit [Ping timeout: 246 seconds]
stan has quit [Ping timeout: 240 seconds]
kp666[m] has quit [Ping timeout: 240 seconds]
mistergibson[m] has quit [Ping timeout: 256 seconds]
NODE has quit [Quit: changing servers]
qbrd[m] has quit [Ping timeout: 246 seconds]
sepp2k has quit [Ping timeout: 246 seconds]
turt2live has quit [Ping timeout: 240 seconds]
execat[m] has quit [Ping timeout: 248 seconds]
linuus[m] has quit [Ping timeout: 252 seconds]
NODE has joined #ruby
<al2o3-cr> timeout bomb proceeding...
<simonfromspace> why does that happen? it's hilarious
<al2o3-cr> matrix screwing things
timmow has quit [Ping timeout: 263 seconds]
timmow has joined #ruby
minall has left #ruby ["ERC (IRC client for Emacs 26.3)"]
howdoi has joined #ruby
qbrd[m] has joined #ruby
batisi[m] has joined #ruby
SeepingN has joined #ruby
royal_screwup21 has joined #ruby
scipio_africanu4 has joined #ruby
<havenwood> simonfromspace: It doesn't matter if the top level class is a module or a class for a namespace—that's irrelevant.
<havenwood> simonfromspace: The superclass of a Class is Module and the class of Class is Module. They're both equally appropriate to use for a namespace.
<havenwood> simonfromspace: The choice of whether your top level constant is a Module or Class should depend on whether you have instance(s) of state. See: https://gist.github.com/havenwood/a81401724cbcbf1f78e79f42ed4b0e33
qbrd[m] has quit [Quit: killed]
<havenwood> simonfromspace: It's easy to come up with an example, since all you need to do is define a method on a class or module of the same name at top level. For example:
scipio_africanu4 has quit [Client Quit]
batisi[m] has quit [Quit: killed]
<havenwood> &>> class String; def to_s; 42 end end
<rubydoc> # => :to_s (https://carc.in/#/r/8ltk)
<havenwood> simonfromspace: Try that ^ in irb.
cold_iron has quit [Read error: Connection reset by peer]
<havenwood> simonfromspace: It changes string for every string in Ruby, not just the code you're working on.
<havenwood> simonfromspace: Now imagine everyone defining top level constants called, JSON, Formatter, String, and how all the code would immediately break when you stomp on methods meant to do something else.
<havenwood> simonfromspace: Also, if you have a `module Foo` and someone else as a `class Foo` it'll just break.
<havenwood> simonfromspace: Pick a top level class of any name. Define a method that's already defined. It breaks. That's why you put all your constants under your gem namespace.
iamayam has quit [Ping timeout: 240 seconds]
iamayam has joined #ruby
Arahael has quit [Ping timeout: 268 seconds]
<al2o3-cr> simonfromspace: what havenwood explained must of sunk in by now?
fphilipe_ has quit [Ping timeout: 258 seconds]
<simonfromspace> al2o3-cr, My brain is processing. I'll need a while.
alfiemax has joined #ruby
<havenwood> simonfromspace: Imagine Ruby defines Foo.bar and tons of things depend on it. You redefine Foo.bar and all those things break. Compare with you defining SimonFromSpace::Foo.bar were nothing breaks.
<havenwood> simonfromspace: Now imagine that you have a project and several gems define Foo.bar differently. That just won't work. But they can define Baz::Foo.bar, Wombat::Foo.bar, Twiddle::Foo.bar and it's fine. Each gem stayed within its namespace.
<simonfromspace> I understand that much. I'm wondering if I should always write my ruby code with Modules inside Classes from now on.
<havenwood> simonfromspace: No!
<simonfromspace> Okay, so just avoid naming them differently, and keep them the same?
<havenwood> simonfromspace: You can have a module or a class as your gem namespace. It does not matter. You should pick which it is, based on whether that outermost module or class has internal instances of state.
<havenwood> simonfromspace: You must have a namespace, a module or a class. Whether you choose a module or a class is a good question. Either is perfectly normal.
<havenwood> simonfromspace: Do use a module or class as your namespace. Think about why you might pick a module or pick a class for that namespace.
<simonfromspace> So in my main.rb if I have a class BottleMaker, the other files should also have a BottleMaker class or module, right?
<havenwood> simonfromspace: main.rb would correspond with a Main class or module.
<havenwood> simonfromspace: Filenames correspond to class and module names.
<simonfromspace> oh I see
<havenwood> simonfromspace: bottle_maker.rb is a BottleMaker class or module.
<simonfromspace> ok, filenames should always equal the namespace inside
<havenwood> simonfromspace: Yes.
<havenwood> simonfromspace: BottleMaker::JSON is a bottle_maker/json.rb
<simonfromspace> ohhh
<simonfromspace> I must have mistaken your advice a little yesterday
<havenwood> simonfromspace: Simone::From::Space is simon/from/space.rb
<simonfromspace> So what I've done is wrong, or right?
<havenwood> (in lib/)
<simonfromspace> Oh! That makes sense.
<havenwood> simonfromspace: that's right. EZTVScraper::Output is eztv_scraper/output.rb
<havenwood> simonfromspace: right?
<simonfromspace> Right
<simonfromspace> It makes sense now. I can access my modules with ::
execat[m] has joined #ruby
<simonfromspace> If I didn't have that class in output.rb, it would work the same, but that also leaves it open to other EZTVScraper, if it existed.
<simonfromspace> Am I right?
<havenwood> No, that seems wrong. It would leave it in conflict with other Output classes OR modules.
<havenwood> simonfromspace: You only get EZTVScraper to put your constant in. DO NOT create any constant outside the EZSTVScraper namespace.
<havenwood> simonfromspace: Just follow the rule. If you've added a constant to Object.constants other than your gem name, you're doing it wrong for now.
<havenwood> EZTVScraper::A_CONSTANT or EZTVScraper::AModule or EZTVScraper::AClass but no ::TopLevelAnyting.
coderhs has joined #ruby
sagax has joined #ruby
<simonfromspace> Okay, and the way to maintain that hierarchy would be to contain them inside the namespace on every file? Right?
<simonfromspace> I think I understand it now.
<simonfromspace> So earlier output was module Output and my options were to either put it inside a class EZTVScraper, or rename the module to EZTVScraper.
<havenwood> simonfromspace: You can not have Output at all or put it inside your namespace.
royal_screwup21 has quit [Remote host closed the connection]
<simonfromspace> In this file, should I have a class TicTacToe wrapping the module MenuHelper
<simonfromspace> From what I've learnt from you, I would write the file names differently but just ignore that for a minute
chalkmonster has quit [Quit: WeeChat 2.7]
<havenwood> simonfromspace: Yes, that sounds right, ignoring the filenames.
<havenwood> simonfromspace: My next suggestion would be to use fewer constants. Start without extras and only extract as you see opportunity.
<simonfromspace> And in case of a Class?
<havenwood> simonfromspace: If you have no need for a second constant, stick with a single top level one. There's no shame in TicTacToe containing the entire functionality of the program.
Rob__ has joined #ruby
<simonfromspace> Alright
<simonfromspace> I'll spend reading on namespaces and getting all this clear
<simonfromspace> Thank you so much for your time havenwood
<havenwood> simonfromspace: I'd suggest choosing whether your top level constant is a class or module based on whether it has internal state: https://gist.github.com/havenwood/a81401724cbcbf1f78e79f42ed4b0e33
<havenwood> simonfromspace: You're welcome.
<simonfromspace> I sometimes can't believe anyone would spend significant amount of time explaining all these, but I really really appreciate it!
<havenwood> simonfromspace: Then put all methods in that top level constant, until you see a reason to refactor them out via extract method or extract class/module refactors.
<havenwood> simonfromspace: Other folk helped me.
<simonfromspace> I will return the favor here someday too :)
pwnd_nsfw has quit [Ping timeout: 255 seconds]
pwnd_nsfw` has quit [Ping timeout: 260 seconds]
pwnd_nsfw has joined #ruby
alfiemax has quit [Remote host closed the connection]
tau has joined #ruby
chalkmonster has joined #ruby
jmcgnh has quit [Read error: Connection reset by peer]
royal_screwup21 has joined #ruby
linuus[m] has joined #ruby
scipio_africanu4 has joined #ruby
turt2live has joined #ruby
stan has joined #ruby
qbrd[m] has joined #ruby
batisi[m] has joined #ruby
sepp2k has joined #ruby
kp666[m] has joined #ruby
mistergibson[m] has joined #ruby
jmcgnh has joined #ruby
Bounga has quit [Ping timeout: 272 seconds]
royal_screwup21 has quit [Remote host closed the connection]
coderhs has quit [Ping timeout: 260 seconds]
alfiemax has joined #ruby
<lmat> I'm writing a rails integration test. How do I adjust the session? I've tried session.clear, controller.session.clear, and @controller.session.clear. Each time, the session appears clear in the integration test, but as soon as code enters the controller again, those session variables are back!! Black magic!
royal_screwup21 has joined #ruby
alfiemax has quit [Ping timeout: 272 seconds]
<ellcs> lmat: i remember dark, but i think it was like controller.session.session
coderhs has joined #ruby
<lmat> wow
<lmat> Checking...
<lmat> no controller.session.session ;-)
<lmat> There are so many sessions...
jenrzzz has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
<lmat> I think they're all the same.... session, controller.session, @controller.session, @request.session.
<lmat> oh, and request.session :-S
fphilipe_ has joined #ruby
coderhs has quit [Quit: Leaving]
fphilipe_ has quit [Ping timeout: 248 seconds]
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
hiroaki has joined #ruby
tdy has quit [Quit: WeeChat 1.9.1]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
<lmat> b/win 1
<al2o3-cr> lmat: using weechat? alt + 1 :)
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
ctOS has quit [Quit: Connection closed for inactivity]
fanta1 has quit [Quit: fanta1]
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
markopasha has joined #ruby
nahmanreally has quit []
SCHAPiE has quit [Quit: ZNC - https://znc.in]
sgen has joined #ruby
SCHAPiE has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
ua has quit [Ping timeout: 240 seconds]
Ai9zO5AP has quit [Ping timeout: 240 seconds]
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
tau has quit [Remote host closed the connection]
Ai9zO5AP has joined #ruby
justJohnathon has joined #ruby
<justJohnathon> I just compiled Ruby via ruby-install ... how do I run specs/tests/etc?
TorpedoSkyline has joined #ruby
Bounga has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
<justJohnathon> I tried this but got basically nothing. `root@arkenstone:/opt/rubies/ruby-2.1.6# bin/ruby lib/ruby/2.1.0/test/unit.rb `
SCHAPiE has quit [Read error: Connection timed out]
<havenwood> justJohnathon: You'd like to run the Ruby tests from the Ruby source?
<havenwood> justJohnathon: cd /usr/local/src/ruby-2.1.6
splud_wurk has quit [Quit: splud_wurk]
<havenwood> justJohnathon: make test
<havenwood> justJohnathon: Check the Makefile for other options.
SCHAPiE has joined #ruby
<havenwood> justJohnathon: PS - That Ruby is past EOL and isn't supported even for critical security issues. Use a newer Ruby!
chalkmonster has quit [Quit: WeeChat 2.7]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
sgen has quit [Ping timeout: 255 seconds]
SeepingN has joined #ruby
<justJohnathon> that's true. Some of my clients don't want to pay to upgrade their software. :/
<justJohnathon> but most do
<justJohnathon> as I suspected, openssl isn't right for this ruby
<justJohnathon> so now I need to recompile
jintseng has quit [Ping timeout: 260 seconds]
<justJohnathon> I'm using chruby and ruby-install.
<justJohnathon> I see a lot of people doing something like this... `PKG_CONFIG_PATH=/opt/local/lib/openssl-1.0/pkgconfig ruby-install ruby-2.3.7 --with-openssl-lib=/opt/local/lib/openssl-1.0`
bsdband6 has joined #ruby
<justJohnathon> I compiled the older version of openssl so I could compile against that, but it doesn't have a pkgconfig file.
smoochsmooch has joined #ruby
bsdbandit-01 has quit [Ping timeout: 260 seconds]
chalkmonster has joined #ruby
istrasci has joined #ruby
<istrasci> If I have a constant A::B (`class A; B = 'b'.freeze; end`), how can I "call" this constant if given the symbol `:b` for it?
<justJohnathon> The convention in Ruby is that constants should be in all capitals.
<istrasci> Nevermind, I can call `A.const_get(:b)`.
<justJohnathon> you can.
<justJohnathon> but why not just call it B ?
<istrasci> I'm not defining it, I'm accessing it.
pwnd_nsfw has quit [Quit: Leaving]
<justJohnathon> istrasci: Someone else defined it?
bsdband6 has quit [Quit: -a- Connection Timed Out]
<al2o3-cr> istrasci: :b is not constant
<istrasci> You guys aren't understanding the scenario.
<justJohnathon> I'd like to
<istrasci> Another method returns `:b` to me (whether from an API or whatever). From that, I need to be the value of `A::B`.
<istrasci> *I need to get
<istrasci> Basically, someone saying, "Here's a symbol. Get the constant in class A that matches it".
<justJohnathon> So if you get a _symbol_ 'b'.to_sym, you should check A::B
<istrasci> Sorry, the symbol returned would be `:B`, not lowercase `:b`.
<al2o3-cr> A.const_get(:b.upcase)
<al2o3-cr> oh
<istrasci> Yes
<justJohnathon> yep, that's where I was going.
<istrasci> The `.const_get` is what I didn't know existed.
<justJohnathon> well I don't think hyou can get symbols
<justJohnathon> from an API
<justJohnathon> but...
<justJohnathon> yep, const_get
<al2o3-cr> istrasci: check if it's defined first with const_defined?
<justJohnathon> ok so here's my question. Am I correct in thinking that you can't compile Ruby 2.3.x against the current version of Open SSL?
<justJohnathon> havenwood: you might know that.
Mallot1 has joined #ruby
<Mallot1> Hello
<Mallot1> Please help me. I wrote 4 functions so I can do basic activerecord database work (Create, Read, Update, and Delete). I'm getting a "car.rb:31: syntax error, unexpected ':', expecting ')' (SyntaxError)" error. Please help me fix this: https://dpaste.org/Bbca . Thanks
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bsdbandit-01 has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.7]
<al2o3-cr> Mallot1: look at line 31
<Mallot1> Nevermind. Now the new error is "NoMethodError at /undefined method `id' for #<Class:0x00000000063e2cf8> Did you mean? ids". I get that when I run "Car.createRecord("Chevvy", "purple") in my controller. Error goes away when I remove line 8.
Rob__ is now known as pwnd_nsfw
<pwnd_nsfw> Who taught you ruby my guy
<Mallot1> al2o3-cr: Thanks, I solved that issue :) . Now I have another one. Same code, with the edits: https://dpaste.org/mXj4
<Mallot1> pwnd_nsfw: I'm new. Just trying to get this to work
<pwnd_nsfw> Did you port it from another language? lol
<Mallot1> lol
<Mallot1> What's wrong with it?
<Mallot1> Do you see the error? :)
<pwnd_nsfw> Like, the conventions you've used are so not ruby at all. I'm sure you will get it to work
<pwnd_nsfw> But it definitely looks like you're coming from another language and diving straight in
<Mallot1> What conventions?
<pwnd_nsfw> Basically, you could probably write the code you have in like... 10 lines of code lol
donofrio has quit [Remote host closed the connection]
<Mallot1> How?
<istrasci> Yeah, if you're using ActiveRecord, you don't need like any of that stuff.
<pwnd_nsfw> Look how how to use active record
<Mallot1> istrasci: Using activerecord.
<pwnd_nsfw> up*
<pwnd_nsfw> Right, so you don't need much of the code you have
TorpedoSkyline has joined #ruby
<pwnd_nsfw> because activerecord does it for you
<Mallot1> istrasci: How do I do this?
<pwnd_nsfw> bro
<pwnd_nsfw> look
citizentwo has quit [Remote host closed the connection]
fphilipe_ has joined #ruby
citizentwo has joined #ruby
jintseng has joined #ruby
fphilipe_ has quit [Ping timeout: 272 seconds]
bsdbandit-01 has quit [Ping timeout: 272 seconds]
bsdband60 has joined #ruby
<Mallot1> pwnd_nsfw: istrasci: Hey, this is an acceptable model? https://dpaste.org/bHmk
jmcgnh has quit [Ping timeout: 246 seconds]
<pwnd_nsfw> yeboi Mallot1
<pwnd_nsfw> ActiveRecord is gonna be your middle man between your code and the database
<justJohnathon> Installing ruby 2.3 is impossible.
<pwnd_nsfw> lies
<Mallot1> pswd_nsfw: Thanks. Yeah I know (cool)
<Mallot1> pwnd_nsfw^^
<Mallot1> pwnd_nsfw: ^^
<pwnd_nsfw> :)
<Mallot1> pwnd_nsfw: Now the new error is "NoMethodError at /undefined method `id' for #<Class:0x00000000063e2cf8> Did you mean? ids". I get that when I run "Car.createRecord("Chevvy", "purple") in my controller. Error goes away when I remove line 8. Can you help me fix this?
<pwnd_nsfw> You don't use that in your controller
<Mallot1> Line 8 specifically.: https://dpaste.org/mXj4
<pwnd_nsfw> Car.create(brand: "Chevvy", color: "purple")
<Mallot1> pwnd_nsfw: Alright
<pwnd_nsfw> start from scracth
<pwnd_nsfw> remove all of
<pwnd_nsfw> that stuff
<pwnd_nsfw> in the model
<pwnd_nsfw> just keep the class definition, it's all you need
alexherbo2 has joined #ruby
<Mallot1> pwnd_nsfw: Here's my lines. How can I get the data?
TorpedoSkyline has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jintseng has quit [Ping timeout: 258 seconds]
<Mallot1> pwnd_nsfw: ^^ (they are not in a controller. Those are just the lines themselves.)
<pwnd_nsfw> They exist as part of you inheriting from activerecord
<pwnd_nsfw> Car.find(...)
<pwnd_nsfw> Are you using rails?
Synthead has joined #ruby
<Mallot1> Oh I see. So how is the data returned from the "result = Car.update(@record_id, "#{passed_field}" => new_value)" line?
<Synthead> If I have a keyword with a default value in a method definition (i.e. def my_method(foo: nil); end) is there a way to tell if I explicitly stated nil or of it's the default value?
<Mallot1> is it in an array or something? In other words how do I just get the data itself? I'm using Sinatra
gavlee has quit [Ping timeout: 260 seconds]
<Mallot1> pwnd_nsfw: ^^
<havenwood> Synthead: The pattern I use for that is: DEFAULT = Object.new.freeze
gavlee has joined #ruby
<pwnd_nsfw> you should consult the documentation
<Mallot1> Hey havenwood, nice to see you again
<pwnd_nsfw> This is pretty basic stuff for active record.
<Mallot1> havenwood: Could you help me with just 4 lines for activerecord? I'm just trying to see if my 4 activerecord lines are written right that's all.
<Mallot1> Here's what I have: https://dpaste.org/Z9KX#L6,8
TCZ has joined #ruby
<pwnd_nsfw> Now I feel like some kind of used slut
<pwnd_nsfw> Good day lol
evert has quit [Quit: ZNC - https://znc.in]
<pwnd_nsfw> justJohnathon, 2.3.8 just installed on my pi4 using rvm
gavlee has quit [Ping timeout: 240 seconds]
nowhereman has quit [Ping timeout: 255 seconds]
gavlee has joined #ruby
<justJohnathon> pwnd_nsfw: with openssl?
evert has joined #ruby
fphilipe_ has joined #ruby
fphilipe_ has quit [Ping timeout: 272 seconds]
hiroaki has quit [Ping timeout: 272 seconds]
justJohnathon has quit [Remote host closed the connection]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
jmcgnh has joined #ruby
john2496 has quit [Remote host closed the connection]
splud_wurk has joined #ruby
Mallot1 has quit [Remote host closed the connection]
drincruz has quit [Ping timeout: 258 seconds]
mossplix has joined #ruby
alfiemax has joined #ruby
davidw has joined #ruby
ellcs has quit [Ping timeout: 240 seconds]
Synthead has quit [Quit: Leaving]
alfiemax has quit [Ping timeout: 258 seconds]
Mallot1 has joined #ruby
<Mallot1> Hello. Why do I get "NoMethodError at /createtestcar undefined method `id' for #<Class:0x0000000006edbad8> Did you mean? ids" on line 10? How do I fix it?
lucasb has quit [Quit: Connection closed for inactivity]
<Mallot1> All I want is the id for the record that was created.
<Mallot1> Thank you :)
donofrio has joined #ruby
jmcgnh has quit [Ping timeout: 268 seconds]
jmcgnh has joined #ruby
<havenwood> pwnd_nsfw: I think they're installing 2.1 and 2.3 was just an example.
impermanence has quit [Ping timeout: 240 seconds]
<Mallot1> How can I get the id of the last inserted row in activerecord? Every time I use "Modelname.id" I get "undefined method `id' for #<Class:0x00000000077aa240> Did you mean? ids"