Often, we can use p foo or foo.inspect to see the instance variables, but is it only the default behavior and the object can choose to show somethi
p foo
foo.inspect
Trying to print a variable defined by attr_writer from outside the class will throw an error (undefined method 'wah' for #) - but for debugging purposes you can use instance_variable_get as such:
undefined method 'wah' for #
b = Bar.new(:wah => "Hello") b.wah # undefined method b.instance_variable_get("@wah") # => "Hello"