Skip to content

Instantly share code, notes, and snippets.

@lenary
Forked from urfolomeus/hello.rb
Created February 3, 2012 14:48
Show Gist options
  • Save lenary/1730507 to your computer and use it in GitHub Desktop.
Save lenary/1730507 to your computer and use it in GitHub Desktop.
Class level privates
class Hello
def self.first
"Boo!"
end
private
def self.second
"Buh!"
end
class << self
def fourth
third
end
private
def third
"Bugger"
end
end
end
Hello.first # => "Boo!"
Hello.second # => "Buh!"
Hello.third # ~> -:27: private method `third' called for Hello:Class (NoMethodError)
Hello.fourth # => "Bugger"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment