From: "Ara.T.Howard" Date: 2006-02-03T05:29:10+09:00 Subject: [RCR] meaningful RUBY_VERSION#<=> i'm sure something much more elegant could be made, but this summarizes desired behaviour. harp:~ > cat a.rb class RubyVersion < ::String include Comparable def <=> other components <=> RubyVersion::new(other).components end def components scan(%r/\d+/).map{|c| Integer c} end def major components[0] end def minor components[1] end def tiny components[2] end module ::Kernel def RubyVersion *a, &b RubyVersion::new *a, &b end v = $VERBOSE $VERBOSE = nil ::RUBY_VERSION = RubyVersion(::RUBY_VERSION) $VERBOSE = v end end p RUBY_VERSION p RUBY_VERSION > "1.8.3" p RUBY_VERSION > "1.9.0" harp:~ > ruby a.rb "1.8.4" true false kind regards. -a -- happiness is not something ready-made. it comes from your own actions. - h.h. the 14th dali lama