Sha256: e72ba293be0cf2464a9456bac2acb5e029f6d4bc54c6ca6a8ba4214b4bb4be90
Contents?: true
Size: 657 Bytes
Versions: 9
Compression:
Stored size: 657 Bytes
Contents
require 'degu/renum/enumerated_value_type_factory' module Degu # Requiring 'renum' mixes the Renum module into both the main Object and # Module, so it can be called from anywhere that you might reasonably # define an enumeration with an implicit receiver. module Renum # Figures out whether the new enumeration will live in Object or the # receiving Module, then delegates to EnumeratedValueTypeFactory#create for # all the real work. def enum(type_name, values = :defined_in_block, &block) nest = self.is_a?(Module) ? self : Object EnumeratedValueTypeFactory.create(nest, type_name, values, &block) end end end
Version data entries
9 entries across 9 versions & 1 rubygems