lib/renum/enumerated_value.rb in renum-0.0.1 vs lib/renum/enumerated_value.rb in renum-0.0.3
- old
+ new
@@ -11,10 +11,11 @@
@values ||= []
end
end
+ include Comparable
attr_reader :name
def initialize name
@name = name.to_s
self.class.values << self
@@ -24,9 +25,13 @@
"#{self.class}::#{name}"
end
def index
self.class.values.index self
+ end
+
+ def <=> other
+ index <=> other.index
end
end
end
\ No newline at end of file