⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (331 Bytes)
Bug #16947
ยป private_method.rb
example private method -
kapitan_morgan (Yaromir Bartosh)
, 06/10/2020 12:17 PM
class
Person
def
speak
puts
"Hey, Tj!"
end
def
whisper_louder
whisper
end
def
whisper_self
self
.
whisper
end
private
def
whisper
puts
"His name's not really 'Tj'."
end
end
p
=
Person
.
new
p
.
speak
p
.
whisper_louder
# should cause an error
# but in version 2.7.1 no error occurs
p
.
whisper_self
(1-1/1)
Loading...