JSON::Serializableexcept if it for some reason only gave you
self.xto refer to an instance variable in an instance method? I seem to be able to use all 3 with the same effect.
@xis the only "safe" thing that will always resolve to an ivar, even if there is another local var or method named x...so is there no reason to use the other 2, other than to make things less explicit and confusing? :)
self.xis if you have customer logic in the getter and/or are using a lazily initialized ivar
var x = [1, 2, 3, 4, 5] var y = [6, 7, 8, 9, 10] x[1..2] = y[1..2] # x => [1, 7, 8, 4, 5]
sign(42.0) # 1.0 sign (-42.0) # -1.0 sign (0.0) # 0.0 fract(42.123) # 0.123
value - (value.floor)probably?
dup? In this case there is nothing to traverse for a deep copy, but I see some projects use
clonein this case, while others use
dup, so I'm not sure if there is a consensus.
scope.ymlhaving the properties
paths, etc. in a
Scopeclass, I'd like to avoid flow control to check the filters as
scope.paths, to something like
scope.filtershaving their own class