Sha256: 40ac528b930dcfb291c28e6a2c179b0f905e0a3389a1f7075e3e67c2d84dfce9

Contents?: true

Size: 342 Bytes

Versions: 1

Compression:

Stored size: 342 Bytes

Contents

$:.unshift File.dirname(__FILE__)
require 'renum/enumerated_value'

module Renum
  def enum type_name, values, &block
    klass = Class.new EnumeratedValue
    Object.const_set(type_name, klass)
    klass.class_eval &block if block_given?
    values.each do |name|
      klass.const_set(name, klass.new(name))
    end
  end
end

extend Renum

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
renum-0.0.1 lib/renum.rb