lib/renum/enumerated_value.rb in renum-1.0.0 vs lib/renum/enumerated_value.rb in renum-1.0.1
- old
+ new
@@ -15,21 +15,19 @@
end
include Comparable
attr_reader :name
+ attr_reader :index
def initialize name
@name = name.to_s
+ @index = self.class.values.size
self.class.values << self
end
def to_s
"#{self.class}::#{name}"
- end
-
- def index
- self.class.values.index self
end
def <=> other
index <=> other.index
end
\ No newline at end of file