public, private, protected
private methods are only callable inside the object. protected allows other instances of the class.
Example
class A
def run = helper
private
def helper = "secret"
end
puts A.new.run
begin
A.new.helper
rescue NoMethodError
puts "private"
endResult
secret private
Exercise
Hide a method.
def x; endQuiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.