Class: FlexibleEnum::ConstantConfigurator

Inherits:
AbstractConfigurator show all
Defined in:
lib/flexible_enum/constant_configurator.rb

Instance Attribute Summary

Attributes inherited from AbstractConfigurator

#attribute_name, #elements, #feature_module, #module_for_elements

Instance Method Summary collapse

Methods inherited from AbstractConfigurator

#add_class_method, #add_instance_method

Instance Method Details

#applyObject



3
4
5
6
7
8
9
# File 'lib/flexible_enum/constant_configurator.rb', line 3

def apply
  elements.each do |element_name, element_config|
    constant_name  = element_name.to_s.upcase
    constant_value = element_config[:value]
    module_for_elements.const_set(constant_name, constant_value)
  end
end