Skip to content

Instantly share code, notes, and snippets.

@mbj
Created September 9, 2013 13:57
Show Gist options
  • Save mbj/6495922 to your computer and use it in GitHub Desktop.
Save mbj/6495922 to your computer and use it in GitHub Desktop.
protected class methods in ruby
class Foo
def self.bar
:baz
end
end
Foo.bar # => :baz, public
class Foo
class << self
protected :bar
end
end
Foo.bar # raises exception
class Foo
bar # works
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment