Follow

PSA:

class Thing
private
def self.foo
end
end

... does not do what you would like it to do.

@james I’ve never even thought of doing that. Got a link to explain what it DOES do?

@brian_kephart @james `private` does nothing special here. it only applies to methods defined as "def <identifer>".

here's the correct way to define a private class method:

class Thing
class << self
private
def foo
end
end
end

Sign in to participate in the conversation
Ruby.social

A Mastodon instance for Rubyists & friends