I have a custom class Region
, which I instantiated as following : node = Region.new
I wonder what is the differences, and why the following conditions act like that :
puts node.class === Region # => false
puts node.class == Region # => true
puts node.is_a?(Region) # => true
puts node.class.to_s === 'Region' # => true
What is the best way to test (ideally, in a case
condition) what is the class of my node (as it could be classes like Country
or Site
as well...)
Thank you for your time :)