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!
markong has quit [Ping timeout: 260 seconds]
gix has quit [Ping timeout: 260 seconds]
bruce_lee has quit [Quit: Konversation terminated!]
drincruz has quit [Ping timeout: 240 seconds]
bocaneri has quit [Ping timeout: 240 seconds]
Pillus has quit [Ping timeout: 240 seconds]
kevinsjoberg has quit [Ping timeout: 240 seconds]
AutomationD has quit [Ping timeout: 240 seconds]
r3my has quit [Ping timeout: 240 seconds]
dputtick has quit [Ping timeout: 240 seconds]
kevinsjoberg has joined #ruby
Pillus has joined #ruby
AutomationD has joined #ruby
r3my has joined #ruby
dputtick has joined #ruby
aurelius has joined #ruby
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
aurelius has quit [Ping timeout: 256 seconds]
mossplix has joined #ruby
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
swaggboi_ has joined #ruby
swaggboi_ has quit [Client Quit]
ur5us has quit [Ping timeout: 244 seconds]
bocaneri has joined #ruby
mossplix has quit [Ping timeout: 256 seconds]
CrazyEddy has quit [Ping timeout: 246 seconds]
baojg has quit [Remote host closed the connection]
ur5us has joined #ruby
zacts has joined #ruby
baojg has joined #ruby
zer0x2b has joined #ruby
<zer0x2b> Hey guys. I'm not sure if I should ask this here or in rails (because attribute is a rails thing), but I'm having an issue with class << self, and accessing attributes of the parent function from within it. Is there a good way of doing this? Here's a snippet of what I mean: https://dpaste.org/jeCF
drincruz has joined #ruby
<zer0x2b> (Note: Attribute is just a class attribute, not a column in the database)
<adam12> zer0x2b: doesn't `attribute` setup _instance_ accessors?
<adam12> ie. x = X.new; x.y = 1; x.y # => 1
cthulchu_ has quit [Ping timeout: 265 seconds]
<zer0x2b> From what I have tried. When I'm trying to access y, from within the class << self block, it says it doesn't exist
<adam12> zer0x2b: That seems right
<adam12> zer0x2b: What are you trying to do at a higher level? do you have any real code you could share?
<zer0x2b> My issue exists with trying to access it from within the class << self block.
<adam12> zer0x2b: How are you trying to access it.
<zer0x2b> Unfortunately I can't share the code. The gist is that I'm trying to have a flag on the parent that I can toggle from within a function. The function lives within the `class << self` block.
<zer0x2b> I'm updating existing code, so I'm not sure the reasoning behind having the `class << self` block, but am trying to figure out how to work around it
<adam12> zer0x2b: Not much to go on :\ `class << self` inside of a class is a re-opening of the Eigenclass or Singleton class. So if you had `class Foo`, you'd be re-opening the class and defining class methods.
<adam12> zer0x2b: The `attribute` class method from Rails defines _instance_ methods. So if you do `class << self`, you need to then get an _instance_ of your class before attempting to use something you've defined using `attribute`.
<zer0x2b> Ah, in the function within `class << self` it does a `create!` the the end of it. I'm guessing that would be creating the instance right? If that's the case, could I also use that create function to set the attribute?
<adam12> zer0x2b: create! will return an instance, yes. So you could `foo = create!; foo.x = your_value; foo`. There's more concise ways of doing it but that might get you unstuck.
mossplix has joined #ruby
<zer0x2b> Do you know if I could do something like `create!(params, y: 6)`?
<adam12> zer0x2b: _maybe_. I don't use Rails so I'm not sure of the API or what `attribute` offers you.
<adam12> zer0x2b: You'd probably need something like `create!(params.merge({y: 6})` tho
<zer0x2b> Gotcha, well this at least points me in the right direction. Thank you so much for helping me even though I couldn't provide that much!
<adam12> zer0x2b: No problem. Good luck.
zacts has quit [Quit: WeeChat 2.8]
mossplix has quit [Ping timeout: 264 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
aurelius has joined #ruby
aurelius has quit [Ping timeout: 265 seconds]
rose_nd_ash has joined #ruby
wymillerlinux has quit [Ping timeout: 264 seconds]
braincrash has quit [Quit: bye bye]
_whitelogger has joined #ruby
braincrash has joined #ruby
wymillerlinux has joined #ruby
aurelius has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bambanx has quit [Quit: Leaving]
cyrus_mc_ has joined #ruby
orbyt_ has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
rose_nd_ash has quit [Ping timeout: 256 seconds]
imode has quit [Quit: WeeChat 2.8]
imode has joined #ruby
imode has quit [Client Quit]
imode has joined #ruby
cyrus_mc_ has quit [Ping timeout: 246 seconds]
zer0x2b has quit [Remote host closed the connection]
alfiemax has joined #ruby
imode has quit [Quit: WeeChat 2.8]
imode has joined #ruby
ChmEarl has quit [Quit: Leaving]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
donofrio has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
howdoi has joined #ruby
rose_nd_ash has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
alfiemax has quit [Ping timeout: 256 seconds]
alfiemax has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
alfiemax_ has joined #ruby
wymillerlinux has quit [Ping timeout: 246 seconds]
alfiemax has quit [Ping timeout: 256 seconds]
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
mozzarella has quit [Remote host closed the connection]
mozzarella has joined #ruby
mossplix has joined #ruby
mossplix has quit [Ping timeout: 260 seconds]
_whitelogger has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
RiPuk has quit [Quit: ZNC 1.8.1 - https://znc.in]
RiPuk has joined #ruby
rose_nd_ash has joined #ruby
alfiemax_ has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 260 seconds]
_whitelogger has joined #ruby
RiPuk has quit [Ping timeout: 240 seconds]
schne1der has joined #ruby
RiPuk has joined #ruby
jetchisel has joined #ruby
mossplix has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
RiPuk has quit [Ping timeout: 264 seconds]
RiPuk has joined #ruby
mossplix has quit [Remote host closed the connection]
baojg has quit [Remote host closed the connection]
_whitelogger has joined #ruby
skape has quit [Quit: Connection closed for inactivity]
vondruch has joined #ruby
mossplix has joined #ruby
dviola has quit [Quit: WeeChat 2.9]
vondruch has quit [Client Quit]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
vondruch has quit [Read error: Connection reset by peer]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
imode has quit [Ping timeout: 240 seconds]
Secret-Fire has quit [Remote host closed the connection]
baojg has joined #ruby
Secret-Fire has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
konsolebox has quit [Read error: Connection reset by peer]
rdash has joined #ruby
TomyWork has joined #ruby
rose_nd_ash has quit [Ping timeout: 246 seconds]
konsolebox has joined #ruby
Fuzzy76 has joined #ruby
<Fuzzy76> How can I do the following while also checking if userinfo returns nil? email = Ldap.userinfo(@uat.user)[:mail].first
<leftylink> hmm. well the &. form of indexing is to use [] as a method. so that'd be &.[](:mail)
alfiemax has joined #ruby
<leftylink> I made assumption sabout what "chekcing of userinfo returns nil" meant.
<leftylink> I apologise if I assumed wrongly
<Fuzzy76> That assumption was correct. The problem is that the server this runs on has ruby 2.0 so &. is off the table :-/
<Fuzzy76> are these lines the equivalent?
alfiemax has quit [Remote host closed the connection]
<Fuzzy76> ldap_info = ldap.userinfo(@uat.user)
<Fuzzy76> email = ldap_info[:mail].first
vondruch_ has joined #ruby
<Fuzzy76> (if so, the if is obvious to me)
<leftylink> yes, by splitting it into mutiple lines, the course of action should be obvious enough
<leftylink> to do it with one line... there is a possibility, but whether it is acceptable will be left to the preferences of those who will have to read it in the future
<leftylink> &>> str = (a = 5) && a.to_s
<rubydoc> # => "5" (https://carc.in/#/r/9gol)
<leftylink> &>> str = (a = nil) && a.to_s
<rubydoc> # => nil (https://carc.in/#/r/9gom)
<Fuzzy76> thanks, I was unsure wether the second line made sense like that. Ruby's syntax is very new to me (this is an inherited legacy codebase)
vondruch has quit [Ping timeout: 265 seconds]
vondruch_ is now known as vondruch
rdash has quit [Remote host closed the connection]
elphe has quit [Ping timeout: 260 seconds]
TomyWork has quit [Ping timeout: 256 seconds]
oddp has joined #ruby
Secret-Fire has quit [Remote host closed the connection]
Secret-Fire has joined #ruby
Secret-Fire has quit [Remote host closed the connection]
Secret-Fire has joined #ruby
mossplix has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
rose_nd_ash has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
Phoebus has joined #ruby
Secret-Fire has quit [Remote host closed the connection]
Secret-Fire has joined #ruby
alfiemax has joined #ruby
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
yxhuvud has joined #ruby
aurelius has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
aurelius has joined #ruby
ur5us has joined #ruby
Mia has quit [Read error: Connection reset by peer]
aesthe has joined #ruby
arahael1 has joined #ruby
Arahael has quit [Ping timeout: 260 seconds]
dionysus69 has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
alfiemax has quit [Remote host closed the connection]
markong has joined #ruby
Mia has joined #ruby
aesthe has quit [Quit: Leaving]
konsolebox has quit [Read error: Connection reset by peer]
alfiemax has joined #ruby
konsolebox has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
cd has quit [Quit: cd]
Mia has quit [Read error: Connection reset by peer]
chalkmonster has joined #ruby
ur5us has quit [Ping timeout: 244 seconds]
FastJack has quit [Ping timeout: 264 seconds]
bruce_lee has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
leitz has joined #ruby
Rounin has joined #ruby
<leitz> Pointers to a doc on how to use Net::HTTP.get? I'm hitting a certificate verify failure, which is expected. Trying to work around a hostname mismatch.
rose_nd_ash has joined #ruby
arahael1 is now known as Arahael
zacts has joined #ruby
aurelius has quit [Remote host closed the connection]
aurelius has joined #ruby
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 256 seconds]
shokohsc6 has joined #ruby
mossplix has joined #ruby
alfiemax has joined #ruby
duderonomy has quit [Ping timeout: 264 seconds]
infernix has quit [Quit: ZNC - http://znc.sourceforge.net]
TCZ has joined #ruby
davispuh has joined #ruby
<leitz> Well, absent tutorial, I dug into the code and left myself an example. https://github.com/makhidkarun/free_trader/blob/web_page/spec/url_pull_spec.rb
fercell has joined #ruby
donofrio has joined #ruby
oddp has quit [Quit: quit]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 246 seconds]
infernix has joined #ruby
vondruch_ has joined #ruby
dualfade has quit [Ping timeout: 240 seconds]
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
dualfade has joined #ruby
vondruch has quit [Ping timeout: 260 seconds]
vondruch_ is now known as vondruch
konsolebox has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
drincruz has joined #ruby
mossplix has quit [Remote host closed the connection]
oddp has joined #ruby
oddp has quit [Client Quit]
rose_nd_ash has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
rose_nd_ash has joined #ruby
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
noodle has quit [Ping timeout: 260 seconds]
noodle has joined #ruby
alfiemax has quit [Remote host closed the connection]
bamdad has quit [Remote host closed the connection]
bamdad has joined #ruby
markong has quit [Ping timeout: 256 seconds]
stryek has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
aurelius has quit []
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
venmx has quit [Ping timeout: 265 seconds]
SeepingN has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
alfiemax has joined #ruby
TCZ has quit [Quit: Leaving]
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
shansen has joined #ruby
imode has joined #ruby
lucasb has joined #ruby
mossplix has joined #ruby
<leitz> Any maths wizards able to double check my expression? To get an "Improved by X%": percentate_improved = ( new - old) / ( old / 100.0)
gitter1234 has joined #ruby
imode has quit [Ping timeout: 264 seconds]
jacksop has joined #ruby
howdoi has joined #ruby
zacts has quit [Quit: WeeChat 2.8]
<adam12> leitz: I use something like this: (new - old) / old.to_f * 100 unless old.zero?
<adam12> leitz: I'm not sure if that's equivalent for you tho. There is percent change and percent difference.
mistergibson has joined #ruby
mossplix has quit [Remote host closed the connection]
MadLamb has joined #ruby
baojg has quit [Remote host closed the connection]
rose_nd_ash has quit [Remote host closed the connection]
<MadLamb> I'm struggling with this problem for 2 days already. I have two rails active record models (Posts and Attachments) and I index some of the posts properties on solr with sunspot. As part of this solr document, I also include the attachments association, which I declare in the Posts model. Because the way the code works when binding those attachments t ther with the Posts, this attachment list is not being indexed when the model record is created
<MadLamb> for the first time. It works as expected when I edit and save again. I was trying to force rails to run the index again by calling Posts.save!, but no matter how many times I do that, it doesn't help. Any idea?
rose_nd_ash has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rippa has joined #ruby
<leitz> adam12, I'm doing resume stuff. "Improved blah-blah by Y%." :)
<adam12> MadLamb: You have a hook defined in your model to call Sunspot?
<MadLamb> adam12, i'm using the "searchable"
alfiemax has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
<MadLamb> adam12, I do attachments.map and convert that to a string, which I stored in a string field with multiple => true
<adam12> MadLamb: You have a sunspot.yml file?
<MadLamb> yes I do, but I am running sunsport with docker
<MadLamb> I mean solr*
<adam12> MadLamb: what are the values for auto_index_callback and auto_remove_callback
<MadLamb> auto_index_callback: after_commit
<MadLamb> the remove is not present
baojg has joined #ruby
<MadLamb> I added this to test, wasnt originally there
<adam12> MadLamb: Do you have anything about "auto_index"?
baojg has quit [Remote host closed the connection]
<adam12> I think it's set to true by default but just curious.
<MadLamb> adam12, in sunspot.yml? no. its just the production env with solr and auto_index_callback keys. Inside solr I have log_level, path and solr_home. That is all.
<adam12> MadLamb: In your model. searchable(auto_index: ??) or anything
<MadLamb> adam12, yeah I think so. I tried to set that to true in the searchable, but no difference
baojg has joined #ruby
<MadLamb> tried that already, also checked the code, it seems to only make a difference if you set to false
<MadLamb> the thing is, the way those things are getting updated in my app, probably fucks with it
mossplix has joined #ruby
<MadLamb> the attachments record is created before the psots
<MadLamb> posts*
<adam12> MadLamb: Can you crank up logging and see if the after_commit hook is running?
<MadLamb> and then later on they get "connected"
<adam12> Oh. I think I see the problem.
<adam12> err, your issue. I thought it wasn't running at all.
<MadLamb> yeah I think its running. It does work when I update
<MadLamb> I hacked around it and forced a second save on update
<MadLamb> but I think the main issue is that by the time the index runs, the model is not updated in memory yet
<MadLamb> (the association)
<MadLamb> it makes the change directly on the attachments model
FastJack has joined #ruby
<MadLamb> instead of going through the posts
<MadLamb> (and in this case it cant I think, because they are not connected yet)
<adam12> MadLamb: I wonder if you add a `touch` to the relationship on attachments back to the post.
<MadLamb> I even tried to do Posts.find and Posts.save to force a second index
<MadLamb> but no idea why it doesnt work
baojg has quit [Remote host closed the connection]
<MadLamb> idk how active record works behind the scenes but maybe if I find a model that is already in memory it doesnt actually make the search
rose_nd_ash has quit [Remote host closed the connection]
<adam12> MadLamb: can you gist the relevant pieces of your Post model?
chalkmonster has quit [Quit: WeeChat 2.9]
rose_nd_ash has joined #ruby
<MadLamb> adam12, https://dpaste.org/RHKi
<MadLamb> just to b clear, I didnt design this :D
<adam12> MadLamb: where you do `attachments.select` can you do `attachments.reload.select`
<MadLamb> adam12, didnt work
<MadLamb> adam12, I think the attachment is only connected after that
<MadLamb> its an independent model
<MadLamb> hold on, let me show you the controller code
<adam12> MadLamb: Depends on the implementation. Models can accept nested objects through `accepts_nested_attributes_for`
<MadLamb> adam12, yeah, I said b4, the implementation is odd
<adam12> MadLamb: My suggestion is to figure out a way to setup an async job that will re-generate the solr stuff.
<adam12> Then just trigger it where you update the records in the controllers. It would be a smell in the model.
alfiemax has joined #ruby
<MadLamb> adam12, https://dpaste.org/Wtho
<MadLamb> adam12, this is awful for me in every single way, but its a 8yo app
<adam12> MadLamb: Yeah. Strange.
<MadLamb> observe the comment
<MadLamb> lmao
<adam12> MadLamb: I'd totally just regenerate separately, inside the controller.
<adam12> MadLamb: You'll have to splunk on a method to trigger the commit hook tho.
<adam12> (without triggering a COMMIT)
<MadLamb> adam12, wdym by regenerate?
<adam12> MadLamb: s/regenerate/index
<MadLamb> adam12, still dont get it
<MadLamb> I would b happy to call something like Sunspot.index and pass the object
<MadLamb> i dont need it to b pretty, will phase out this part of the app soon
<MadLamb> I just need it to work
<MadLamb> this searchable magic is awful. tight coupling
rose_nd_ash has quit [Remote host closed the connection]
<adam12> Yep
<adam12> MadLamb: There's a #index method. Could you just do @project.reload.index after associate_attachments() in your controller?
rose_nd_ash has joined #ruby
dionysus69 has quit [Remote host closed the connection]
<MadLamb> adam12, still the same =/
al2o3-cr has quit [Quit: WeeChat 2.9]
<adam12> MadLamb: how about index!
<adam12> MadLamb: I dont use Sunspot or Solr so I'm shooting in the dark here.
skape has joined #ruby
cthulchu_ has joined #ruby
<MadLamb> adam12, no effect :/
<MadLamb> adam12, I wish I was also not using it
<MadLamb> I plan to migrate to elastic asap
<adam12> MadLamb: Oh man. Pot to the fire.
<adam12> MadLamb: instead of re-using the @project instance, refetch it. Project.find(@project.id).index!
<adam12> MadLamb: Maybe the association is still cached? I don't know if `reload` clears the association cache.
gr33n7007h has joined #ruby
jacksop has quit []
<MadLamb> adam12, https://dpaste.org/yP9a
cthulchu_ has quit [Read error: Connection reset by peer]
<MadLamb> this also didnt work :D
<adam12> ¯\_(ツ)_/¯
cthulchu_ has joined #ruby
<MadLamb> I probably should consider migrating to elasticsearch
<MadLamb> I already wasted so much time with this shit
alfiemax_ has joined #ruby
alfiemax_ has quit [Read error: Connection reset by peer]
alfiemax_ has joined #ruby
alfiemax has quit [Ping timeout: 256 seconds]
nod0n[m] has joined #ruby
hiroaki has quit [Ping timeout: 240 seconds]
fercell has quit [Quit: WeeChat 2.8]
orbyt_ has joined #ruby
gr33n7007h is now known as al2o3-cr
shokohsc6 has quit [Quit: The Lounge - https://thelounge.chat]
schne1der has quit [Ping timeout: 240 seconds]
shokohsc has joined #ruby
alfiemax_ has quit [Remote host closed the connection]
alfiemax has joined #ruby
<rapha> MadLamb: fwiw, it might not be as convenient, but I was so far able to do everything I needed to do with rsolr.
alfiemax has quit [Ping timeout: 246 seconds]
<MadLamb> rapha, will definetely take a look
<MadLamb> rapha, did u try sunspot before?
Emmanuel_Chanel has quit [Ping timeout: 256 seconds]
Fuzzy76 has left #ruby ["In the words of the great philosopher Eric Cartman - screw you guys, I'm going home!"]
<rapha> MadLamb: tried and failed and gave up.
<rapha> adam12: does regular Ruby have something like https://github.com/schleyfox/peach ?
<adam12> rapha: Regular Ruby? You mean in stdlib?
<adam12> rapha: I'd probably use the parallel gem. It doesn't monkeypatch Array.
Emmanuel_Chanel has joined #ruby
rose_nd_ash has quit [Remote host closed the connection]
rose_nd_ash has joined #ruby
<rapha> I mean non-Java-based Ruby.
phablet has joined #ruby
* rapha looks at parallel
<rapha> That'll work nicely, thank you!
rose_nd_ash has quit [Remote host closed the connection]
alfiemax has joined #ruby
ChmEarl has joined #ruby
phablet has quit [Read error: Connection reset by peer]
duderonomy has joined #ruby
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
zapata has quit [Ping timeout: 246 seconds]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has quit [Ping timeout: 240 seconds]
SeepingN has joined #ruby
SeepingN has quit [Client Quit]
zapata has joined #ruby
chalkmonster has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
_aeris_ has quit [Ping timeout: 240 seconds]
_aeris has joined #ruby
jottr has joined #ruby
Ven`` has joined #ruby
konsolebox has joined #ruby
swaggboi has quit [Quit: C-x C-c]
swaggboi has joined #ruby
chris_ has joined #ruby
rose_nd_ash has joined #ruby
rose_nd_ash has quit [Ping timeout: 240 seconds]
Rudd0 has quit [Ping timeout: 256 seconds]
markong has joined #ruby
dionysus69 has joined #ruby
alfiemax has joined #ruby
Rudd0 has joined #ruby
gix has joined #ruby
rose_nd_ash has joined #ruby
troulouliou_div2 has joined #ruby
Iarfen has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
<adam12> Anybody evangelising or practicing the Doctrine of Useful Objects in any of their projects? http://docs.eventide-project.org/user-guide/useful-objects.html#overview
<apotheon> adam12: not knowingly by that name
phablet_ has joined #ruby
<adam12> apotheon: Some of the practices look familiar tho? I'm using substitutes in many places and I'm enjoying it. Some of the other ones are interesting.
konsolebox has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
teclator has quit [Ping timeout: 240 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
orbyt_ has quit [Quit: Textual IRC Client: www.textualapp.com]
konsolebox has joined #ruby
Rudd0 has quit [Ping timeout: 240 seconds]
saphappy has joined #ruby
<saphappy> hi
saphappy has left #ruby ["see ya!"]
rose_nd_ash has quit [Remote host closed the connection]
vondruch_ has joined #ruby
cthulchu_ has quit [Read error: Connection reset by peer]
cthulchu_ has joined #ruby
vondruch has quit [Ping timeout: 265 seconds]
vondruch_ is now known as vondruch
linuus[m] has quit [Ping timeout: 244 seconds]
finn[m] has quit [Ping timeout: 244 seconds]
jottr has quit [Quit: WeeChat 2.9]
ruurd has quit [Quit: bye folks]
zapata has quit [Ping timeout: 246 seconds]
zapata has joined #ruby
troulouliou_div2 has quit [Ping timeout: 246 seconds]
chalkmonster has quit [Quit: WeeChat 2.9]
dnadev2 has joined #ruby
troulouliou_div2 has joined #ruby
cd has joined #ruby
ritalinona has joined #ruby
linuus[m] has joined #ruby
alfiemax has quit [Ping timeout: 256 seconds]
finn[m] has joined #ruby
troulouliou_div2 has quit [Ping timeout: 265 seconds]
Phoebus has quit [Quit: Connection closed for inactivity]
zapata has quit [Ping timeout: 246 seconds]
<havenwood> sapphyrus: hi
<havenwood> oops
chalkmonster has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
chalkmonster has quit [Client Quit]
konsolebox has quit [Read error: Connection reset by peer]
leitz has quit [Quit: Leaving]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
troulouliou_div2 has joined #ruby
<dnadev2> can anyone help me figure out the best approach to DRY up code that shares a method between two classes that uses an instance var in the shared method? here is the set up: https://dpaste.org/dETz
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
_aeris_ has joined #ruby
konsolebox has joined #ruby
_aeris has quit [Ping timeout: 240 seconds]
<ritalinona> dnadev2: you could inherit from a third class that has all the same code
cnsvc has joined #ruby
<dnadev2> ritalinona, and if i do that -- with the parent have access to that @instance var i set in the child? Child < Parent
<dnadev2> s/with/will
<phaul> I would use mixin prly in this case.
<phaul> also I would expose the instance var as reader that the mixin can use. ( instance var would work, but acess via method feels better somehow. like comparable does it with <=>
<phaul> )
ur5us has joined #ruby
<dnadev2> phaul, thank you - gonna try the mixin route! may have a follow up question :)
chris_ has quit []
schne1der has joined #ruby
schne1der has quit [Ping timeout: 244 seconds]
plutes has joined #ruby
<dnadev2> phaul, i've simplified it a bit to get my head around the concept -- this the right route? https://dpaste.org/5Uck
<dnadev2> just have to look into the reader concept
<dnadev2> (although i don't have this working yet via irb)
<deimos_> 101636
<deimos_> sorry wrong tmux pane
alexherbo2 has joined #ruby
jetchisel has joined #ruby
heidar has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
kristian_on_linu has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
BSaboia has joined #ruby
mossplix has quit [Remote host closed the connection]
Rudd0 has joined #ruby
mossplix has joined #ruby
arzWZM has quit [Ping timeout: 265 seconds]
arzWZM has joined #ruby
kristian_on_linu has quit [Quit: No Ping reply in 180 seconds.]
<phaul> dnadev2: you are on the right path with the Bakery module, but there is some confusion about the current self in the classes. At class level self would be the class, so @user outside of instance method definition in for example BreadWorker would be an instance variable of the class itself - not the instance of it..
kristian_on_linu has joined #ruby
SeepingN has joined #ruby
Secret-Fire has quit [Remote host closed the connection]
<phaul> class X; @foo; end; @foo is an instance variable stored in the Class object called X. class X; def bar; @foo; end; end; here it's different @foo is an instance variable stored in the object you get by instantiating X with calling X.new
skape has quit [Quit: Connection closed for inactivity]
<dnadev2> yesss, this is making an insane amount of sense :) thank you phaul and havenwood!
Secret-Fire has joined #ruby
* dnadev2 still needs to learn how to assess situations to determine mixin vs inheritance situations
BSaboia has quit [Quit: This computer has gone to sleep]
Secret-Fire has quit [Remote host closed the connection]
<phaul> my two pence. real class inheritance is only a choice if the classes make sense in the domain as such. The parent and child classes are all real things in the domain, that you want to instantiate, and Liskov is respected. If you just want to code dry, go with modules
_aeris_ has quit [Ping timeout: 240 seconds]
_aeris_ has joined #ruby
Secret-Fire has joined #ruby
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
Secret-Fire has quit [Remote host closed the connection]
Secret-Fire has joined #ruby
kristian_on_linu has quit [Quit: No Ping reply in 180 seconds.]
kristian_on_linu has joined #ruby
BSaboia has joined #ruby
mossplix has quit [Remote host closed the connection]
kristian_on_linu has quit [Ping timeout: 240 seconds]
arzWZM has quit [Read error: No route to host]
arzWZM has joined #ruby
BSaboia has quit [Quit: This computer has gone to sleep]
bocaneri is now known as Sauvin
MrCrackPot has quit [Remote host closed the connection]
plutes has quit [Ping timeout: 272 seconds]
skape has joined #ruby
wymillerlinux has joined #ruby
mossplix has joined #ruby
mossplix has quit [Ping timeout: 244 seconds]
drincruz has quit [Ping timeout: 246 seconds]
robotmay has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
plutes has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
Axy has joined #ruby
Mia has quit [Ping timeout: 256 seconds]
hrluthbgsioteuao has joined #ruby
markong has quit [Ping timeout: 264 seconds]
hrluthbgsioteuao has quit [Remote host closed the connection]
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]