Does Ruby comply with information hiding?

I am new to Ruby and started to learn it a few months ago. And this is
my first post in this forum.

I was taugth that OOP is a good way to comply with encapsulation and
information hiding. Ruby is a OO programming language. So I can’t
understand why Ruby objects respond to methods like:

instance_variable_get
instance_variable_set
instance_eval

Any ideas?

Ronaldo Persiano wrote in post #1146725:

I was taugth that OOP is a good way to comply with encapsulation and
information hiding. Ruby is a OO programming language. So I can’t
understand why Ruby objects respond to methods like:

instance_variable_get
instance_variable_set
instance_eval

Any ideas?

It allows you to do amazing things with meta programming etc. It does
not strictly prohibit access to internal state but kindly asks you to
not mess with it - unless you know exactly what you are doing.

Cheers

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs