<thistledown>
is there any way to call the handle_save method from class2 on the instance_of_class1 from inside the instance?
<woodruffw>
you could add an instance method to class1 that calls class2.handle_save
<thistledown>
oooooooh.
<thistledown>
and I could do something like self.class2.handle_save?
<thistledown>
is there a way to reference self without making the method think I'm talking about the class2 instance?
haxx0r71 has joined #ruby
<woodruffw>
depends on the context you're in
<woodruffw>
if you're writing an instance method on class1, self will refer to your current class1 instance
<thistledown>
okay, so if I write the instance method to be the class2.handle_save call, I could self.call it and it would theoretically call on itself
haxx0r has quit [Ping timeout: 272 seconds]
<woodruffw>
`self.call` will try to call the `call` method, which probably doesn't exist
<woodruffw>
you can use `send` to send methods to arbitrary objects, but that usually isn't what you want when getting started with ruby's OOP
<thistledown>
I've done nothing but procedural bash and perl ever
<thistledown>
so it's a big 'ol shift for me
<thistledown>
(and I wasn't particularly good at those either)
gix has joined #ruby
gix- has quit [Ping timeout: 252 seconds]
haxx0r71 is now known as haxx0r
fphilipe has joined #ruby
armyriad has quit [Ping timeout: 272 seconds]
fphilipe has quit [Ping timeout: 258 seconds]
armyriad has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
thistledown has quit [Ping timeout: 258 seconds]
<cerulean>
baweaver: yeah its a test. I got an extension. tomorrow gonna try again
<cerulean>
they're a phone company
<cerulean>
apparently parsing phone numbers is hell. US and EU are different formats
<baweaver>
Why does the random string method need to be in a different class?
jenrzzz has joined #ruby
<baweaver>
If it were a class method, sure
<baweaver>
Though it sounds like that should be a method of class 1
<baweaver>
Can you paste your current code here https://dpaste.de/ and select Ruby as the language?
<baweaver>
I still think that this sounds like both methods should be in class 1
mr_rich101 has joined #ruby
<baweaver>
thistledown: problem 1 - Why class1 and class2? Can you think of better more descriptive names for what they are?
<baweaver>
problem 2 - Why is class2 distinct from class1?
<baweaver>
Answering questions like these help you build intuition in writing code
<baweaver>
It's very difficult to answer questions about abstract entities, because the answers will be very different depending on your usecases
<baweaver>
Then start with names
<baweaver>
OO deals with the _what_ of programming
<baweaver>
Names like class1 and class2 do not communicate the intent of the classes, nor why they should be classes
<baweaver>
By finding a name you define what behavior it should and should not have
<baweaver>
It would be very odd for a Bike class to have a fly method
<baweaver>
or a Plane a swim method
<baweaver>
They don't really belong, the names give us an insight into the expected behavior of the code inside so we can make reasonable assumptions about them
<baweaver>
class1 and class2 don't give you that
<baweaver>
After names you start to get into messages. How does a Human communicate with a Bike or a Car? Probably through a ride or drive method.
dbugger has joined #ruby
<baweaver>
The hard truth is that immediate answers will not help you learn. Thinking on problems and reasoning about them, building that intuition, and asking questions to that front will.
hutch has joined #ruby
hutch has quit [Client Quit]
staticx is now known as exmortus
<baweaver>
That's almost rigged
<baweaver>
The only way to really handle it would be a really nasty regex
<baweaver>
or tokenization or any type of format detection
<baweaver>
Granted not as bad as emails but eesh
imadper has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
Fusl has quit [Remote host closed the connection]
dbz has quit [Remote host closed the connection]
Fusl has joined #ruby
dbz has joined #ruby
fphilipe has joined #ruby
dbz has quit [Ping timeout: 248 seconds]
laaron has quit [Ping timeout: 256 seconds]
jenrzzz has quit [Ping timeout: 248 seconds]
fphilipe has quit [Ping timeout: 252 seconds]
altious has quit [Killed (hitchcock.freenode.net (Nickname regained by services))]
Guest66416 has joined #ruby
laaron has joined #ruby
kyrylo has joined #ruby
esp32_prog has joined #ruby
jenrzzz has joined #ruby
dellavg_ has quit [Ping timeout: 245 seconds]
dbz has joined #ruby
esp32_prog has quit [Ping timeout: 272 seconds]
jenrzzz has quit [Ping timeout: 268 seconds]
houhouli_ has quit [Remote host closed the connection]
jenrzzz has joined #ruby
shortCircuit__ has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
dviola has quit [Quit: WeeChat 2.4]
dbz has quit [Remote host closed the connection]
shortCircuit__ has quit [Quit: WeeChat 1.8]
Azure has joined #ruby
Azure has quit [Changing host]
Azure has joined #ruby
conta has joined #ruby
powerbit has quit [Read error: Connection reset by peer]
FrankDW2 has quit [Read error: Connection reset by peer]
Tempesta_ has joined #ruby
FrankDW2 has joined #ruby
giraffe has quit [Excess Flood]
giraffe_ has joined #ruby
Tempesta_ has left #ruby [#ruby]
Tempesta is now known as Guest5254
Guest5254 has quit [Ping timeout: 258 seconds]
Tempesta has joined #ruby
armyriad has quit [Ping timeout: 258 seconds]
rafadc has quit [Read error: Connection reset by peer]
Xiti has quit [Quit: Xiti]
armyriad has joined #ruby
Xiti has joined #ruby
rafadc has joined #ruby
ur5us has quit [Remote host closed the connection]
sauvin has joined #ruby
ur5us has joined #ruby
ur5us has quit [Ping timeout: 272 seconds]
PaddyF has joined #ruby
<PaddyF>
hello. i installed 2.6.3 into my user's $HOME and wonder what the next step is - do i need the extra package rubygems?
codefriar has joined #ruby
sagax has joined #ruby
schne1der has joined #ruby
hiroaki has quit [Ping timeout: 272 seconds]
TomyLobo has joined #ruby
aupadhye has joined #ruby
<havenwood>
PaddyF: RubyGems ships with Ruby 2.6.3. It should *just work*.
<havenwood>
PaddyF: You can update gem separately from Ruby with: gem update --system
jenrzzz has joined #ruby
themsay has joined #ruby
gix has quit [Ping timeout: 248 seconds]
PaddyF has quit [Ping timeout: 252 seconds]
brer has quit [Quit: ZNC 1.6.5+deb1+deb9u1 - http://znc.in]
brer has joined #ruby
Yxhvd is now known as yxhuvud
alem0lars__ has joined #ruby
PaddyF has joined #ruby
tdy has joined #ruby
fphilipe has joined #ruby
schne1der has quit [Ping timeout: 245 seconds]
esp32_prog has joined #ruby
andikr has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
esp32_prog has quit [Ping timeout: 248 seconds]
DTZUZO has joined #ruby
ur5us has joined #ruby
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
Onwarion has joined #ruby
ur5us has quit [Ping timeout: 272 seconds]
Onwarion has left #ruby [#ruby]
roblucas has joined #ruby
codefriar has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
andikr has quit [Ping timeout: 248 seconds]
andikr has joined #ruby
schne1der has joined #ruby
klarrimore_ has joined #ruby
nowhereman has quit [Ping timeout: 245 seconds]
dbz has joined #ruby
deepredsky has quit [Ping timeout: 246 seconds]
armyriad has quit [Read error: Connection reset by peer]
dbz has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 258 seconds]
conta1 has joined #ruby
jenrzzz has joined #ruby
PaddyF has quit [Quit: bbl]
conta has quit [Ping timeout: 258 seconds]
conta1 is now known as conta
jenrzzz has quit [Ping timeout: 252 seconds]
Kestrel-029 has quit [Ping timeout: 245 seconds]
dbugger has quit [Remote host closed the connection]
jenrzzz has joined #ruby
Nicmavr has joined #ruby
fphilipe has quit [Read error: Connection reset by peer]
teclator has joined #ruby
armyriad has joined #ruby
fphilipe has joined #ruby
esp32_prog has joined #ruby
alem0lars__ has quit [Remote host closed the connection]
alem0lars_ has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
ricekrispie has joined #ruby
Kestrel-029 has joined #ruby
Nicmavr has quit [Ping timeout: 245 seconds]
roblucas has quit [Quit: This computer has gone to sleep]
andikr has quit [Ping timeout: 248 seconds]
mikecmpbll has joined #ruby
klarrimore_ has quit [Ping timeout: 248 seconds]
andikr has joined #ruby
sagax has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
sphenxes has joined #ruby
deepredsky has joined #ruby
universa1 has quit [Quit: ZNC 1.6.1+deb1~ubuntu14.04.0 - http://znc.in]
fphilipe has quit [Ping timeout: 248 seconds]
universa1 has joined #ruby
fphilipe has joined #ruby
ricekrispie has quit [Read error: Connection reset by peer]
ricekrispie has joined #ruby
ljarvis has joined #ruby
meinside has quit [Quit: Connection closed for inactivity]
jefffrails35 has quit [Remote host closed the connection]
alem0lars__ has quit [Ping timeout: 248 seconds]
rbanffy has quit [Quit: rbanffy]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
doodlebug has joined #ruby
doodlebug has quit [Max SendQ exceeded]
TomyLobo has joined #ruby
fredmorcos has joined #ruby
octos has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rabautius has quit [Remote host closed the connection]
whathappens has joined #ruby
cerulean has joined #ruby
cerulean has quit [Ping timeout: 248 seconds]
nowhereman has quit [Ping timeout: 258 seconds]
orbyt_ has joined #ruby
fphilipe has joined #ruby
deathwishdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hays has quit [Quit: No Ping reply in 180 seconds.]
hays has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Max SendQ exceeded]
fphilipe has quit [Ping timeout: 258 seconds]
sauvin has quit [Ping timeout: 248 seconds]
ravenousmoose has joined #ruby
fphilipe has joined #ruby
dbz_ has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dbz has joined #ruby
budonyc has joined #ruby
orbyt_ has joined #ruby
dbz has quit [Ping timeout: 248 seconds]
doodlebug has joined #ruby
doodlebug has quit [Max SendQ exceeded]
dviola has joined #ruby
happyhans has joined #ruby
esp32_prog has joined #ruby
houhoulis has joined #ruby
octos has quit [Read error: Connection reset by peer]
<happyhans>
Can Matz sign my computer?
octos has joined #ruby
jenrzzz has joined #ruby
matheusmoreira has quit [Ping timeout: 252 seconds]
ua has quit [Excess Flood]
orbyt_ has quit [Ping timeout: 248 seconds]
matheusmoreira has joined #ruby
esp32_prog has quit [Ping timeout: 248 seconds]
<phaul>
&fake Matz.quote
<rubydoc>
Most programs are not write-once. They are reworked and rewritten again and again in their lived. Bugs must be debugged. Changing requirements and the need for increased functionality mean the program itself may be modified on an ongoing basis. During this process, human beings must be able to read and understand the original code. It is therefore more important by far for humans to be able to understand the program than it is for the computer.
<phaul>
that's all I can do for you happyhans :)
<happyhans>
tyty
<phaul>
just to clarify, "I" means the chat, where the core members yet to show up :P
ua has joined #ruby
fphilipe has quit [Ping timeout: 258 seconds]
mikecmpbll has joined #ruby
gix has joined #ruby
suukim has quit [Quit: Konversation terminated!]
AJA4350 has quit [Ping timeout: 248 seconds]
queip has quit [Ping timeout: 248 seconds]
DTZUZO has quit [Quit: WeeChat 2.0]
queip has joined #ruby
fphilipe has joined #ruby
dbugger has quit [Read error: Connection reset by peer]
dbugger has joined #ruby
PaddyF has quit [Quit: bbl]
dbz has joined #ruby
dbz has quit [Remote host closed the connection]
dbz has joined #ruby
eletious has joined #ruby
brer has joined #ruby
rbanffy has joined #ruby
cd has joined #ruby
queip has quit [Ping timeout: 268 seconds]
TomyLobo2 has joined #ruby
orbyt_ has joined #ruby
queip has joined #ruby
Fusl has quit [Ping timeout: 256 seconds]
fredmorcos has quit [Remote host closed the connection]
roblucas has quit [Quit: This computer has gone to sleep]
orbyt_ has quit [Ping timeout: 248 seconds]
NL3limin4t0r is now known as NL3limin4t0r_afk
fphilipe has quit [Ping timeout: 258 seconds]
roblucas has joined #ruby
<powerbit>
hi guys, do you use andand or &. when checking for nil? Do you have a link to some article comparing the two?
<SeepingN>
I use .nil?
schne1der has quit [Ping timeout: 252 seconds]
<leftylink>
pretty much I just translate mechanically. whenever I would have written thing && thing.f in 2.2 I write it as thing&.f . however there are some times where I wouldn't be able to use that pattern
skarlso has quit [Read error: Connection reset by peer]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<SeepingN>
seems I'm missing more to the question than is visibly present on that 1 line
dbz has quit [Ping timeout: 248 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
skarlso has joined #ruby
gr33n7007h has quit [Quit: If the universe is a machine where the future is uniquely determined by its present state, it would not be possible to calculate what the future will be.]
skarlso has quit [Client Quit]
skarlso has joined #ruby
cthulchu_ has joined #ruby
Milos has quit [Ping timeout: 258 seconds]
mochiyoda has quit [Ping timeout: 250 seconds]
al2o3-cr has joined #ruby
queip has quit [Ping timeout: 258 seconds]
TomyLobo has quit [Quit: Leaving]
NL3limin4t0r_afk is now known as NL3limin4t0r
<NL3limin4t0r>
powerbit: For me it depends on the contex. Depending on the context you could also implement the Null Object pattern and simply use `thing.method`.
queip has joined #ruby
deathwishdave has joined #ruby
vs^ has quit []
NL3limin4t0r is now known as NL3limin4t0r_afk
cthulchu_ has quit [Ping timeout: 246 seconds]
hutch has joined #ruby
queip has quit [Ping timeout: 244 seconds]
esp32_prog has joined #ruby
orbyt_ has joined #ruby
abaiste^ has joined #ruby
ricardo_ has joined #ruby
esp32_prog has quit [Ping timeout: 272 seconds]
roblucas has quit [Quit: This computer has gone to sleep]
mochiyoda has joined #ruby
queip has joined #ruby
roblucas has joined #ruby
Milos has joined #ruby
ricardo_ is now known as [rg]
roblucas has quit [Client Quit]
jenrzzz has quit [Ping timeout: 272 seconds]
salerace has joined #ruby
jenrzzz has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 248 seconds]
matheusmoreira has quit [Ping timeout: 244 seconds]
Swyper has joined #ruby
jcalla has quit [Quit: Leaving]
mochiyoda has quit [Quit: Konversation terminated!]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rbanffy has joined #ruby
ricardo_ has quit [Remote host closed the connection]
happyhans has quit [Quit: Page closed]
budonyc has quit [Quit: Leaving]
tdy has quit [Ping timeout: 258 seconds]
frem has quit [Quit: Connection closed for inactivity]
sameerynho has quit [Ping timeout: 248 seconds]
fphilipe has joined #ruby
dbz_ has quit [Remote host closed the connection]
tdy has joined #ruby
hightower3 has joined #ruby
hightower2 has quit [Ping timeout: 258 seconds]
queip has quit [Ping timeout: 252 seconds]
fphilipe has quit [Ping timeout: 248 seconds]
jeremycw has quit [Ping timeout: 258 seconds]
Iarfen has quit [Remote host closed the connection]
dar123 has joined #ruby
queip has joined #ruby
orbyt_ has joined #ruby
ricardo_ has joined #ruby
rbanffy has quit [Quit: rbanffy]
whathappens has quit [Remote host closed the connection]
whathappens has joined #ruby
dbugger has quit [Ping timeout: 248 seconds]
ricardo_ is now known as [rg]
pwnd_nsfw` has joined #ruby
<miah>
nil? is typically a smell
pwnd_nsfw has quit [Ping timeout: 272 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pwnd_nsfw has joined #ruby
pwnd_nsfw has quit [Read error: Connection reset by peer]
pwnd_nsfw` has quit [Ping timeout: 248 seconds]
pwnd_nsfw has joined #ruby
<powerbit>
I use user.andand.get_age in case user is nil, so that I cam avoid 'nil do not have a method called get_age'. Or equivalently I can do user&.get_age
altious has joined #ruby
altious has quit [Remote host closed the connection]
Guest66416 has quit [Quit: Leaving]
<powerbit>
and I was wondering what do you use in this case preferentially
altious has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
<powerbit>
andand is a gem in my project
orbyt_ has joined #ruby
octos has quit [Ping timeout: 248 seconds]
nemesit|znc has quit [Ping timeout: 264 seconds]
reber has quit [Read error: Connection reset by peer]
mikecmpbll has quit [Quit: inabit. zz.]
cerulean has joined #ruby
esp32_prog has joined #ruby
pwnd_nsfw` has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch has quit [Quit: WeeChat 2.4]
cerulean has quit [Ping timeout: 246 seconds]
houhoulis has quit [Remote host closed the connection]
esp32_prog has quit [Ping timeout: 248 seconds]
pwnd_nsfw has quit [Ping timeout: 252 seconds]
haxx0r has quit [Ping timeout: 246 seconds]
TomyLobo2 has quit [Read error: Connection reset by peer]
salerace has quit [Quit: salerace]
Swyper_ has joined #ruby
Swyper has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
Swyper_ has quit [Remote host closed the connection]
AJA4350 has joined #ruby
i9zO5AP has quit [Quit: WeeChat 2.4]
moei has quit [Quit: Leaving...]
orbyt_ has joined #ruby
ruby638 has joined #ruby
ruby352 has joined #ruby
<SeepingN>
oh I didn't even realize "andand" was literally a thing. I thought you meant &&. interesting
<SeepingN>
we have "try" in our Rails project.
ruby638 has quit [Ping timeout: 256 seconds]
ruby352 has quit [Ping timeout: 256 seconds]
sevak has joined #ruby
sevak has quit [Client Quit]
jenrzzz has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
whathappens has quit []
bambanx has joined #ruby
<havenwood>
&. ftw.
<rubydoc>
parser error at position 0 around `.'
<leftylink>
amazing.
hagabaka has quit [Remote host closed the connection]
_mak has quit [Remote host closed the connection]
paraxial has quit [Ping timeout: 272 seconds]
haxx0r has joined #ruby
hagabaka has joined #ruby
PaddyF has joined #ruby
_mak has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]