polishdub has quit [Remote host closed the connection]
polishdub has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
desnudopenguino has joined #ruby
deadmarshal_ has joined #ruby
jenrzzz has joined #ruby
polishdub has quit [Ping timeout: 240 seconds]
aphorise has joined #ruby
<aphorise>
Newbie question how to express an if statement such that: if a == "1" || (a == "2" && b == "t") ; .... ?
polishdub has joined #ruby
<adam12>
aphorise: Looks OK to me? other than the semi colon at the end.
polishdub has quit [Ping timeout: 260 seconds]
polishdub has joined #ruby
<aphorise>
@adam12, thanks the actual condition I have is a bit more complex and I cant spot what's wrong with this > elsif RbConfig::CONFIG["target_cpu"] == "x86_64" || RbConfig::CONFIG["target_cpu"] == "x64" || ( RbConfig::CONFIG["target_cpu"] == "universal" && RbConfig::CONFIG["target"].include?("darwin") )
<adam12>
Looks fine. What does `RbConfig::CONFIG` look like? why do you think it's not working?
<aphorise>
@adam12, because I get the generic error: ...:439: syntax error, unexpected `end', expecting end-of-input
finsternis has quit [Ping timeout: 264 seconds]
<aphorise>
but when I comment out the lines affiliated to the elsif it works
finsternis has joined #ruby
<adam12>
What's inside the `elsif`?
<aphorise>
@adam12, dow - I'm an idiot - there was a bad / extra " - thanks for the hints - fixed!
<adam12>
Nice!
jenrzzz has joined #ruby
xxz has joined #ruby
xxz has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 268 seconds]
infinityfye has quit [Ping timeout: 255 seconds]
kerunaru has quit [Quit: Iridium IRC Client]
cek has quit [Quit: Connection closed for inactivity]
infinityfye has joined #ruby
<henk>
regarding my function from yesterday: https://git.netwichtig.de/cgit/user/henk/code/ruby/macir.git/tree/macir.rb?h=feature/challenges_per_apex&id=e3a206b8484ef7919053a38e4e6b92492c8a8642#n162 I was told (and will do it) to extract e.g. a "propagated?" function out of it to make it simpler/smaller. I have already been thinking about it before but this is yet another case where this thought crept up on
<henk>
me: would it make sense to make these challenges a dedicated object (i.e. 'class macir::challenge::dns or something) and making "propagated?" an instance method?
<adam12>
henk: I don't see why not.
<adam12>
henk: Some objects will appear naturally, but if I see a bunch of methods with the same prefix that's almost always an object waiting to escape.
<adam12>
s/objects/classes
<henk>
my thinking is that all these things I handle in this program have certain attributes and methods. like the challenge: it is already a class/object (https://www.rubydoc.info/gems/acme-client/2.0.14/Acme/Client/Resources/Challenges/DNS01) but I associate more info with it and want to add more methods to it that are specific to how my client uses this object. so I guess I should subclass it?
<adam12>
Alternatively you can use a delegator of some sort. See SimpleDelegator in stdlib.
desnudopenguino has quit [Quit: desnudopenguino]
desnudopenguino has joined #ruby
<henk>
hm, too complicated, I don’t get it and I think I should stick to simple inheritance for now
_ht has quit [Remote host closed the connection]
DTZUZU has joined #ruby
osc4rpt has quit [Quit: leaving]
osc4rpt has joined #ruby
<[0x1eef_]>
Vanilla delegation is often simpler. All you have to do is forward a method call from one object to the next. 'method_missing' can make it dynamic.
jenrzzz has joined #ruby
<[0x1eef_]>
Inheritance works but it implies an "is a" relationship Ford can subclass Vehicle because that relationship makes sense. If you find yourself inheriting features rather than a concept then I'd usually agree that a different approach would make more sense.
DTZUZU has quit [Quit: WeeChat 4.0.5]
DTZUZU has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
<henk>
hm, I need to think about that, thanks for the input!
user71 has quit [Quit: Leaving]
DTZUZU has quit [Quit: WeeChat 4.0.5]
Linux_Kerio has quit [Ping timeout: 255 seconds]
smp- has joined #ruby
smp has quit [Read error: Connection reset by peer]
smp- is now known as smp
mange has joined #ruby
rvalue- has joined #ruby
rvalue has quit [Ping timeout: 264 seconds]
<henk>
hm, I think inheritance doesn’t help in my case and delegator might actually be exactly what I want. I use the acme-client class to do most acme stuff and it gives me back e.g. a Acme::Client::Ressources::Challenges::DNS01 object. so subclassing/superclassing (is the latter even a thing?) doesn’t help me at all because that’s what I get. but when I use SimpleDelegator I’m supposed to give a
<henk>
concrete object instance anyway when I instantiate my class. so I would instantiate my Macir::Challenge::Dns class object with an instance of Acme::Client::Ressources::Challenges::DNS01 and have it behave the same plus my added functionality. right?
rvalue- is now known as rvalue
cyberworm54 has joined #ruby
reset has quit [Quit: reset]
jenrzzz has quit [Ping timeout: 240 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
zayd has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
<[0x1eef_]>
henk: Sounds like a good start. The right design might be more apparent once you go in that direction.
jenrzzz has quit [Ping timeout: 272 seconds]
<[0x1eef_]>
I'm kinda on the fence about your class being the class it encapsulates, I think you could call that an implementation detail.
jenrzzz has joined #ruby
<[0x1eef_]>
That'd make your interface your own plus acme's. It might be nicer just to have your own interface that doesn't expose acmes as well.