Let's say for instance I have the following case:
module A
module B
def self.make
@correlation_id ||= SecureRandom.uuid
end
end
end
Now, for the outside world, I only want them to be able to access correlation_id through module A:
A.correlation_id. How would I access @correlation_id from module A?
I did the following, and it worked, but had a side-effect I didn't want.
module A
module B
def self.make
@correlation_id ||= SecureRandom.uuid
end
private
def self.correlation_id
@correlation_id
end
end
def self.correlation_id
A::B.correlation_id
end
end
With that in place, after I do A::B.make, I could do A.correlation_id, but sadly I am also able to do A::B.correlation_id. How would I alleviate this issue?