Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRubyComparable and spaceshipSingle-choice MCQ

For a class that includes Comparable and defines <=> as shown, what is the value of `a == b`?

class Version include Comparable attr_reader :parts def initialize(str) @parts = str.split('.').map(&:to_i) end def <=>(other) parts <=> other.parts end end a = Version.new('1.2.0') b = Version.new('1.2') a == b