Sha256: a257f6c93ce3b719808657a9fcc9693ced138080a3c18afccaab64a14ba562a9

Contents?: true

Size: 483 Bytes

Versions: 1

Compression:

Stored size: 483 Bytes

Contents

module Renum
  class EnumeratedValue
    
    class << self
      include Enumerable
      extend Forwardable
      
      def_delegators :values, :each, :[]
      
      def values
        @values ||= []
      end
      
    end
    
    attr_reader :name
    
    def initialize name
      @name = name.to_s
      self.class.values << self
    end
    
    def to_s
      "#{self.class}::#{name}"
    end
    
    def index
      self.class.values.index self
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
renum-0.0.1 lib/renum/enumerated_value.rb