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

A Version class includes Comparable and defines <=> based on its integer parts array. Defining only <=> for free, which methods does Comparable provide?

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