#ruby - 27 February 2019
« Back 1 day Forward 1 day »
[01:32:35] havenwood: xco: That's pretty much right. I'd just suggest reducing the number of method calls:
[01:34:32] havenwood: I like that the lonely person operator is someone sitting crosslegged staring at a dot: &.
[09:11:23] fox_mulder_cp: hi, folks. i try to create a DNS control gem, which operated of three of four items - Server, DnsZone, RRSet, Record. how i can write proper code, where initialized server passed to zone, and some from zone passed to rrset for operations?
[09:14:24] fox_mulder_cp: for some like zonelist = Server.new(ip,login,pass).zones; rrset = RRSet.new(name, content); zone = Server.new(ip,login,pass).zone.create(name, nsservers, rrset);
[21:51:08] ramfjord: Alright I got a good one for you guys. Trying to dynamically create a class with a proc/lambda which uses functions from an included module inlcuded in the newly generated class. Think it will be easier to just show: https://gist.github.com/ramfjord/0142e2b27e0e065f9d14815c9591fbd2
[22:25:36] havenwood: ramfjord: I commented on your gist with an example showing prepending a module.
[22:35:36] havenwood: Net: You might need to show us that one in context. It seems from what you've shown that you just have: bar.baz
[22:36:13] havenwood: Net: Do you really need an explicit `false`? If `bar.baz #=> nil`, it's already falsey.
[22:47:27] leftylink: while it would be possible to do `x|!0` to change nil to false, I would find it more likely that it's not necessary to change nil to false
[23:02:48] leftylink: golfing, so it's better to write `false` in as few chars as possible... but then I realised that !!x is one char less than x|!0
[23:04:59] leftylink: in the same vein, one wants to write `p` instead of `nil` and `!p` instead of `true`
[23:11:02] leftylink: ... whoops, which also made me realise it doesn't work if x is possibly a number, since then it will do something for `|` (bitwise or) that I didn't want it to do